<template>
  <div class="fishbone-wrapper">
    <div class="content-wrapper">
      <div class="fishbone-container">
        <div class="fishbone">
          <!-- 鱼尾 -->
          <div class="fish-head">
            <img src="../../public/鱼尾.png" alt="鱼尾" class="head-image"/>
          </div>

          <!-- 主骨和节点 -->
          <div class="main-bone">
            <!-- 身份信息节点 - 向上展开 -->
            <div class="main-node identity-node expand-up" :class="{ active: isIdentityOpen }">
              <div class="node-circle" @click="toggleIdentity">
                <span>身份<br/>信息</span>
                <i class="fas" :class="isIdentityOpen ? 'fa-chevron-down' : 'fa-chevron-up'"></i>
              </div>
              <div class="branches centered" v-if="isIdentityOpen">
                <div class="branch-box" v-for="item in identityLeft" :key="item.id"
                     :class="{ disabled: item.content === '暂无' }" @click="showDetail(item.id, 'identity')">
                  <div class="box-title">{{ item.title }}</div>
                </div>
              </div>
            </div>
            <!-- 身份信息节点 - 向下展开 -->
            <div class="main-node identity-node expand-down" :class="{ active: isIdentityOpen }">
              <div class="node-circle" @click="toggleIdentity">
                <span>身份<br/>信息</span>
                <i class="fas" :class="isIdentityOpen ? 'fa-chevron-down' : 'fa-chevron-up'"></i>
              </div>
              <div class="branches centered" v-if="isIdentityOpen">
                <div class="branch-box" v-for="item in identityLeft2" :key="item.id"
                     :class="{ disabled: item.content === '暂无' }" @click="showDetail(item.id, 'identity')">
                  <div class="box-title">{{ item.title }}</div>
                </div>
              </div>
            </div>


            <!-- 财产信息节点 - 向上展开 -->
            <div class="main-node property-node expand-up" :class="{ active: isPropertyOpen }">
              <div class="node-circle" @click="toggleProperty">
                <span>财产<br/>信息</span>
                <i class="fas" :class="isPropertyOpen ? 'fa-chevron-up' : 'fa-chevron-down'"></i>
              </div>
              <div class="branches centered" v-if="isPropertyOpen">
                <div class="branch-box" v-for="item in propertyRight" :key="item.id"
                     :class="{ disabled: item.content === '暂无' }" @click="showDetail(item.id, 'property')">
                  <div class="box-title">{{ item.title }}</div>
                </div>
              </div>
            </div>

            <!-- 财产信息节点2 - 向下展开 -->
            <div class="main-node property-node expand-down" :class="{ active: isPropertyOpen }">
              <div class="node-circle" @click="toggleProperty">
                <span>财产<br/>信息</span>
                <i class="fas" :class="isPropertyOpen ? 'fa-chevron-up' : 'fa-chevron-down'"></i>
              </div>
              <div class="branches centered" v-if="isPropertyOpen">
                <div class="branch-box" v-for="item in propertyRight2" :key="item.id"
                     :class="{ disabled: item.content === '暂无' }" @click="showDetail(item.id, 'property')">
                  <div class="box-title">{{ item.title }}</div>
                </div>
              </div>
            </div>

            <!-- 消费信息节点 - 向下展开 -->
            <div class="main-node consumption-node expand-down" :class="{ active: isConsumptionOpen }">
              <div class="node-circle" @click="toggleConsumption">
                <span>消费<br/>信息</span>
                <i class="fas" :class="isConsumptionOpen ? 'fa-chevron-down' : 'fa-chevron-up'"></i>
              </div>
              <div class="branches centered" v-if="isConsumptionOpen">
                <div class="branch-box" v-for="item in consumptionLeft" :key="item.id"
                     :class="{ disabled: item.content === '暂无' }" @click="showDetail(item.id, 'consumption')">
                  <div class="box-title">{{ item.title }}</div>
                </div>
              </div>
            </div>

            <!-- 行动轨迹节点 - 向上展开 -->
            <div class="main-node action-node expand-up" :class="{ active: isActionOpen }">
              <div class="node-circle" @click="toggleAction">
                <span>行动<br/>轨迹</span>
                <i class="fas" :class="isActionOpen ? 'fa-chevron-up' : 'fa-chevron-down'"></i>
              </div>
              <div class="branches centered" v-if="isActionOpen">
                <div class="branch-box" v-for="item in actionRight" :key="item.id"
                     :class="{ disabled: item.content === '暂无' }" @click="showDetail(item.id, 'action')">
                  <div class="box-title">{{ item.title }}</div>
                </div>
              </div>
            </div>

            <!-- 关联信息节点 - 向下展开 -->
            <div class="main-node relation-node expand-down" :class="{ active: isRelationOpen }">
              <div class="node-circle" @click="toggleRelation">
                <span>关联<br/>信息</span>
                <i class="fas" :class="isRelationOpen ? 'fa-chevron-down' : 'fa-chevron-up'"></i>
              </div>
              <div class="branches centered" v-if="isRelationOpen">
                <div class="branch-box" v-for="item in relationLeft" :key="item.id"
                     :class="{ disabled: item.content === '暂无' }" @click="showDetail(item.id, 'relation')">
                  <div class="box-title">{{ item.title }}</div>
                </div>
              </div>
            </div>
          </div>

          <!-- 鱼头 -->
          <div class="fish-tail">
            <img src="../../public/鱼头.png" alt="鱼头" class="tail-image"/>
          </div>
        </div>
      </div>
    </div>

    <!-- 弹窗组件 -->
    <el-dialog v-model="dialogVisible" :title="dialogTitle" width="60%">
      <el-table :data="dialogTableData" border style="width: 100%" :empty-text="dialogEmptyText">
        <el-table-column v-for="column in dialogTableColumns" :key="column.prop" :prop="column.prop"
                         :label="column.label" :formatter="column.formatter">
          <template #default="scope" v-if="column.prop === 'file'">
            <el-button
                v-if="scope.row.file"
                @click="showPdf(scope.row.file)"
                type="primary"
                size="small"
                link
            >
              查看PDF
            </el-button>
            <span v-else>无PDF文件</span>
          </template>
        </el-table-column>
      </el-table>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">关闭</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
import axios from "axios";
import { useGlobalParamsStore } from '@/store/globalParams';
export default {
  name: "FishboneDiagram",
  props: {
    idNumber: String,
    name: String,
    phone: String,
  },
  // 暴露全局变量
  setup(){
    const globalStore = useGlobalParamsStore();
    return {
      globalStore
    };
  },
  data() {
    return {
      // 控制各节点展开/折叠状态
      isIdentityOpen: true,
      isPropertyOpen: true,
      isConsumptionOpen: true,
      isActionOpen: true,
      isRelationOpen: true,
      isMarriageInfoLoaded: false,

      // 从DataSummary.vue复用的数据
      usageInfo: [],
      shipInfo: [],
      residentInfo: [],
      realEstateInfo: [],
      letterInfo: [],
      caseInfo: [],
      familyInfo: [],
      specialEvents: [],
      relatedPeople: [],
      personEnterpriseInfo: [],
      personalInfo: {},
      selfAddressFrequency: [],
      meituanData: null,
      coOwnershipInfo: "暂无关联财产",
      predictedAddress: "无信息",
      isDataLoaded: false,

      // 新增数据
      vehicleInfo: [],
      bankCardInfo: [],
      residentDistributionInfo: [],
      expressInfo: [],
      socialSecurityInfo: [],
      housingFundInfo: [],
      financialInfo: [],
      meituanOrderList: [],
      driveLicenceInfo: [],
      marriageInfo: [],
      schoolInfo: [],
      crossCarInfo: [],
      //新增医保信息
      hibpersonalInsuranceInfo: [], //人员参保（医疗局）
      insuredPersonInfo: [], //参保信息（医疗局）
      hrsspersonalInsuranceInfo: [], //人员参保（人社局）
      unitInformationInfo: [], //单位基本信息（人社局）
      personalInformationInfo: [], //人员基本信息（人社局）
      medicalPersonInfo:[], //医疗长期居外或异地安置人员基本信息
      // 人员缴费信息
      personalPaymentInfo: [],
      // 新增房产相关数据
      secondHandHouseData: [],
      houseOwnershipData: [],
      cityHouseData: [],
      housePDF: [],
      mergePDF: [],
      //身份核查与火化信息
      liveandfireInfo: [],
      // 低保信息
      subsistenceAllowanceInfo: [],
      // 社保卡信息
      socialSecurityCardInfo: [],
      //退休人员查询
      retireInfo: [],
      // 单位参保信息
      unitInsuranceInfo: [],
      //适龄学生资助减免信息
      studentassistInfo: [],
      //人员参保变更信息查询(人社局)
      personnelInsuranceModificationInfo: [],
      // 工伤待遇支付明细查询(人社局)
      injuryPaymentDetailInfo: [],
      // 工伤认定结果信息查询(人社局)
      workInjuryRecognitionInfo: [],
      // 养老生存认证查询(人社局)
      pensionSurvivalAuthenticationInfo: [],
      //体检信息
      personphysicalexaminationInfo: [],
      //住（出）院信息
      hospitalInfo:[],
      //门诊信息
      outpatientserviceInfo:[],
      //疫苗接种信息
      vaccinationInfo:[],
      // 接口加载状态 - 外部接口
      isSubsistenceAllowanceLoaded: false,
      isSubsistenceAllowanceError: false,
      isSocialSecurityCardLoaded: false,
      isSocialSecurityCardError: false,
      isRetireLoaded: false,
      isRetireError: false,
      isUnitInsuranceLoaded: false,
      isUnitInsuranceError: false,
      isPersonnelInsuranceModificationLoaded: false,
      isPersonnelInsuranceModificationError: false,
      isInjuryPaymentDetailLoaded: false,
      isInjuryPaymentDetailError: false,
      isWorkInjuryRecognitionLoaded: false,
      isWorkInjuryRecognitionError: false,
      isPensionSurvivalAuthenticationLoaded: false,
      isPensionSurvivalAuthenticationError: false,
      isSecondHandHouseLoaded: false,
      isSecondHandHouseError: false,
      isHouseOwnershipLoaded: false,
      isHouseOwnershipError: false,
      isCityHouseLoaded: false,
      isCityHouseError: false,
      isSchoolLoaded: false,
      ishibpersonalInsuranceLoaded: false, //人员参保（医疗局）
      isinsuredPersonLoaded: false, //参保信息（医疗局）
      ishrsspersonalInsuranceLoaded: false, //人员参保（人社局）
      isunitInformationLoaded: false, //单位基本信息（人社局）
      ispersonalInformationLoaded: false, //人员基本信息（人社局）
      ishibpersonalInsuranceError: false, //人员参保（医疗局）
      isinsuredPersonError: false, //参保信息（医疗局）
      ishrsspersonalInsuranceError: false, //人员参保（人社局）
      isunitInformationError: false, //单位基本信息（人社局）
      ispersonalInformationError: false, //人员基本信息（人社局）
      isMedicalPersonLoaded: false,
      isMedicalPersonError:false,
      //身份核查和火化信息
      isliveandfireError: false,
      isliveandfireLoaded: false,
      //体检信息
      ispersonphysicalexaminationLoaded: false,
      ispersonphysicalexaminationError: false,
      //住（出）院信息
      ishospitalLoaded: false,
      ishospitalError: false,
      //门诊信息
      isoutpatientserviceLoaded: false,
      isoutpatientserviceError: false,
      //疫苗接种信息
      isvaccinationLoaded: false,
      isvaccinationError: false,
      isstudentassistLoaded: false,
      isstudentassistError: false,
      isSchoolError: false,
      isCrossCarLoaded: false,
      isCrossCarError: false,
      isShipLoaded: false,
      isShipError: false,
      isResidentDistributionLoaded: false,
      isResidentDistributionError: false,
      isDriveLicenceLoaded: false,
      isDriveLicenceError: false,
      isMarriageInfoError: false,
      // 人员缴费状态
      isPaymentInfoError: false,
      isPaymentInfoLoaded: false,
      // 接口加载状态 - 非外部接口
      isQueryIdLoaded: false,
      isQueryIdError: false,
      isRelatedPeopleLoaded: false,
      isRelatedPeopleError: false,
      isMeituanLoaded: false,
      isMeituanError: false,
      isPersonEnterpriseLoaded: false,
      isPersonEnterpriseError: false,
      isSelfAddressFrequencyLoaded: false,
      isSelfAddressFrequencyError: false,
      isBankAccountLoaded: false,
      isBankAccountError: false,
      isVehicleLoaded: false,
      isVehicleError: false,
      isSocialSecurityLoaded: false,
      isSocialSecurityError: false,
      isMeituanOrderLoaded: false,
      isMeituanOrderError: false,
      isPersonInfoLoaded: false,
      isPersonInfoError: false,
      isHousingFundLoaded: false,
      isHousingFundError: false,
      isFinancialLoaded: false,
      isFinancialError: false,

      // 弹窗相关
      dialogVisible: false,
      dialogTitle: "",
      dialogTableData: [],
      dialogTableColumns: [],
      dialogEmptyText: "暂无相关数据",
    };
  },
  computed: {
    identityLeft() {
      const identityData = [];

      // 单位信息 - 从社保信息中提取当前单位
      if (this.isSocialSecurityLoaded) {
        if (this.socialSecurityInfo && this.socialSecurityInfo.length > 0) {
          console.log("单位信息", this.socialSecurityInfo)
          const latestSocialInfo = this.socialSecurityInfo.reduce((latest, current) => {
            if (!latest) return current;
            const latestDate = latest.currentInsuranceDate || "";
            const currentDate = current.currentInsuranceDate || "";
            return currentDate > latestDate ? current : latest;
          }, null);

          if (latestSocialInfo && latestSocialInfo.currentCompany) {
            identityData.push({
              id: "unit",
              title: "单位信息",
              content: `${latestSocialInfo.currentCompany || "未知公司"} (${latestSocialInfo.status || "未知状态"
              })`,
            });
          } else {
            identityData.push({
              id: "unit",
              title: "单位信息",
              content: "可查看",
            });
          }
        } else {
          identityData.push({
            id: "unit",
            title: "单位信息",
            content: "可查看",
          });
        }
      } else if (this.isSocialSecurityError) {
        identityData.push({
          id: "unit",
          title: "单位信息",
          content: "可查看",
        });
      } else {
        identityData.push({
          id: "unit",
          title: "单位信息",
          content: "暂无",
        });
      }

      // 婚姻信息 - 从 familyInfo 中提取
      if (this.isMarriageInfoLoaded) {
        identityData.push({
          id: "marriage",
          title: "婚姻信息",
          content: `共 ${this.marriageInfo.length} 条记录。`,
        });
      } else if (this.isMarriageInfoError) {
        identityData.push({
          id: "marriage",
          title: "婚姻信息",
          content: "可查看",
        });
      } else {
        identityData.push({
          id: "marriage",
          title: "婚姻信息",
          content: "暂无",
        });
      }

      // 户籍信息 - 修改为只创建一个节点
      if (this.isPersonInfoLoaded) {
        if (this.personalInfo && Object.keys(this.personalInfo).length > 0) {
          // 检查是否有任何户籍成员
          let hasHouseholdMembers = false;
          for (let i = 1; i <= 7; i++) {
            if (this.personalInfo[`householdMember${i}Name`]) {
              hasHouseholdMembers = true;
              break;
            }
          }

          if (hasHouseholdMembers) {
            identityData.push({
              id: "household",
              title: "户籍信息",
              content: "点击查看详细户籍成员信息",
            });
          } else {
            identityData.push({
              id: "household",
              title: "户籍信息",
              content: "可查看",
            });
          }
        } else {
          identityData.push({
            id: "household",
            title: "户籍信息",
            content: "可查看",
          });
        }
      } else if (this.isPersonInfoError) {
        identityData.push({
          id: "household",
          title: "户籍信息",
          content: "可查看",
        });
      } else {
        identityData.push({
          id: "household",
          title: "户籍信息",
          content: "暂无",
        });
      }

      // 从驾驶证信息 ——从驾驶证接口获取
      if (this.isDriveLicenceLoaded) {
        if (this.driveLicenceInfo && this.driveLicenceInfo.length > 0) {
          console.log("存在驾驶证信息")
          identityData.push({
            id: 'driveLicence',
            title: '驾驶证信息(网约车资质信息)',
            content: `${this.driveLicenceInfo.HOLDER_NAME || '未知人名'} (${this.driveLicenceInfo.HOLDER_CODE || '未知身份证'})`
          });
        } else {
          identityData.push({
            id: 'driveLicence',
            title: '驾驶证信息(网约车资质信息)',
            content: '可查看',
          });
        }
      } else if (this.isDriveLicenceError) {
        identityData.push({
          id: 'driveLicence',
          title: '驾驶证信息(网约车资质信息)',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'driveLicence',
          title: '驾驶证信息(网约车资质信息)',
          content: '暂无'
        });
      }
      // 高校学籍信息——接口获取
      if (this.isSchoolLoaded) {
        if (this.schoolInfo && this.schoolInfo.length > 0) {
          console.log("存在高校学籍信息")
          identityData.push({
            id: 'school',
            title: '高校学籍信息',
            content: `${this.schoolInfo.yxmc || '未知高校'}`
          });
        } else {
          identityData.push({
            id: 'school',
            title: '高校学籍信息',
            content: '可查看',
          });
        }
      } else if (this.isSchoolError) {
        identityData.push({
          id: 'school',
          title: '高校学籍信息',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'school',
          title: '高校学籍信息',
          content: '暂无'
        });
      }
      // 人员参保（医疗局）——接口获取

      return identityData;
    },
    identityLeft2(){
      const identityData = [];
      if (this.isSubsistenceAllowanceLoaded){
        if(this.subsistenceAllowanceInfo && this.subsistenceAllowanceInfo.length > 0){
          console.log("存在低保信息")
          identityData.push({
            id:'subsistenceAllowance',
            title: '低保对象信息',
            content: `${this.subsistenceAllowanceInfo || '未知低保信息'}`
          });
        }else {
          identityData.push({
            id:'subsistenceAllowance',
            title: '低保对象信息',
            content: '可查看',
          });
        }
      }else if (this.isSubsistenceAllowanceError){
        identityData.push({
          id:'subsistenceAllowance',
          title: '低保对象信息',
          content: '可查看',
        });
      }else {
        identityData.push({
          id:'subsistenceAllowance',
          title: '低保对象信息',
          content: '暂无',
        });
      }
      //社保卡信息
      if (this.isSocialSecurityCardLoaded){
        if (this.socialSecurityCardInfo && this.socialSecurityCardInfo.length > 0){
          console.log("存在社保卡信息");
          identityData.push({
            id: 'socialSecurityCard',
            title: '社保卡信息',
            content: `${this.socialSecurityCardInfo || '未知社保卡信息'}`
          });
        }else {
          identityData.push({
            id: 'socialSecurityCard',
            title: '社保卡信息',
            content: `可查看`
          });
        }
      }else if (this.isSocialSecurityCardError){
        identityData.push({
          id: 'socialSecurityCard',
          title: '社保卡信息',
          content: `可查看`
        });
      }else {
        identityData.push({
          id: 'socialSecurityCard',
          title: '社保卡信息',
          content: `暂无`
        });
      }

      //身份与火化信息
      if (this.isliveandfireLoaded){
        if (this.liveandfireInfo && this.liveandfireInfo.length > 0){
          console.log("存在身份与火化信息");
          identityData.push({
            id: 'liveandfire',
            title: '身份与火化信息',
            content: `${this.liveandfireInfo || '身份与火化信息'}`
          });
        }else {
          identityData.push({
            id: 'liveandfire',
            title: '身份与火化信息',
            content: `可查看`
          });
        }
      }else if (this.isliveandfireError){
        identityData.push({
          id: 'liveandfire',
          title: '身份与火化信息',
          content: `可查看`
        });
      }else {
        identityData.push({
          id: 'liveandfire',
          title: '身份与火化信息',
          content: `暂无`
        });
      }

      if (this.ishibpersonalInsuranceLoaded) {
        if (this.hibpersonalInsuranceInfo && this.hibpersonalInsuranceInfo.length > 0) {
          console.log("存在人员参保（医疗局）信息")
          identityData.push({
            id: 'hibpersonalInsurance',
            title: '人员参保（医疗局）信息',
            content: `${this.hibpersonalInsuranceInfo || '未知人员参保（医疗局）'}`
          });
        } else {
          identityData.push({
            id: 'hibpersonalInsurance',
            title: '人员参保（医疗局）信息',
            content: '可查看',
          });
        }
      } else if (this.ishibpersonalInsuranceError) {
        identityData.push({
          id: 'hibpersonalInsurance',
          title: '人员参保（医疗局）信息',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'hibpersonalInsurance',
          title: '人员参保（医疗局）信息',
          content: '暂无'
        });
      }
      // 参保信息（医疗局）——接口获取
      if (this.isinsuredPersonLoaded) {
        if (this.insuredPersonInfo && this.insuredPersonInfo.length > 0) {
          console.log("存在参保信息（医疗局）信息")
          identityData.push({
            id: 'insuredPerson',
            title: '参保信息（医疗局）信息',
            content: `${this.insuredPersonInfo || '未知参保信息（医疗局）信息'}`
          });
        } else {
          identityData.push({
            id: 'insuredPerson',
            title: '参保信息（医疗局）信息',
            content: '可查看',
          });
        }
      } else if (this.isinsuredPersonError) {
        identityData.push({
          id: 'insuredPerson',
          title: '参保信息（医疗局）信息',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'insuredPerson',
          title: '参保信息（医疗局）信息',
          content: '暂无'
        });
      }
      // 人员参保（人社局）——接口获取
      if (this.ishrsspersonalInsuranceLoaded) {
        if (this.hrsspersonalInsuranceInfo && this.hrsspersonalInsuranceInfo.length > 0) {
          console.log("存在人员参保（人社局）信息")
          identityData.push({
            id: 'hrsspersonalInsurance',
            title: '人员参保（人社局）信息',
            content: `${this.hrsspersonalInsuranceInfo || '人员参保（人社局）信息'}`
          });
        } else {
          identityData.push({
            id: 'hrsspersonalInsurance',
            title: '人员参保（人社局）信息',
            content: '可查看',
          });
        }
      } else if (this.ishrsspersonalInsuranceError) {
        identityData.push({
          id: 'hrsspersonalInsurance',
          title: '人员参保（人社局）信息',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'hrsspersonalInsurance',
          title: '人员参保（人社局）信息',
          content: '暂无'
        });
      }
      // 单位基本信息（人社局）——接口获取
      if (this.isunitInformationLoaded) {
        if (this.unitInformationInfo && this.unitInformationInfo.length > 0) {
          console.log("存在单位基本信息（人社局）")
          identityData.push({
            id: 'unitInformation',
            title: '单位基本信息（人社局）',
            content: `${this.unitInformationInfo || '未知单位基本信息（人社局）'}`
          });
        } else {
          identityData.push({
            id: 'unitInformation',
            title: '单位基本信息（人社局）',
            content: '可查看',
          });
        }
      } else if (this.isunitInformationError) {
        identityData.push({
          id: 'unitInformation',
          title: '单位基本信息（人社局）',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'unitInformation',
          title: '单位基本信息（人社局）',
          content: '暂无'
        });
      }
      // 人员基本信息（人社局）——接口获取
      if (this.ispersonalInformationLoaded) {
        if (this.personalInformationInfo && this.personalInformationInfo.length > 0) {
          console.log("存在人员基本信息（人社局）")
          identityData.push({
            id: 'personalInformation',
            title: '人员基本信息（人社局）',
            content: `${this.personalInformationInfo || '未知人员基本信息（人社局）'}`
          });
        } else {
          identityData.push({
            id: 'personalInformation',
            title: '人员基本信息（人社局）',
            content: '可查看',
          });
        }
      } else if (this.ispersonalInformationError) {
        identityData.push({
          id: 'personalInformation',
          title: '人员基本信息（人社局）',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'personalInformation',
          title: '人员基本信息（人社局）',
          content: '暂无'
        });
      }
      // 企业退休人员信息（人社局）
      if (this.isRetireLoaded) {
        if (this.retireInfo && this.retireInfo.length > 0) {
          console.log("存在企业退休人员信息（人社局）")
          identityData.push({
            id: 'retire',
            title: '企业退休人员信息（人社局）',
            content: `${this.retireInfo || '未知企业退休人员信息（人社局）'}`
          });
        } else {
          identityData.push({
            id: 'retire',
            title: '企业退休人员信息（人社局）',
            content: '可查看',
          });
        }
      } else if (this.isRetireError) {
        identityData.push({
          id: 'retire',
          title: '企业退休人员信息（人社局）',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'retire',
          title: '企业退休人员信息（人社局）',
          content: '暂无'
        });
      }
      // 单位参保信息
      if (this.isUnitInsuranceLoaded) {
        if (this.unitInsuranceInfo && this.unitInsuranceInfo.length > 0) {
          console.log("存在单位参保信息")
          identityData.push({
            id: 'unitInsurance',
            title: '单位参保信息',
            content: `${this.unitInsuranceInfo || '未知单位参保信息'}`
          });
        } else {
          identityData.push({
            id: 'unitInsurance',
            title: '单位参保信息',
            content: '可查看',
          });
        }
      } else if (this.isUnitInsuranceError) {
        identityData.push({
          id: 'unitInsurance',
          title: '单位参保信息',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'unitInsurance',
          title: '单位参保信息',
          content: '暂无'
        });
      }
      // 人员参保变更信息查询(人社局)
      if (this.isPersonnelInsuranceModificationLoaded) {
        if (this.personnelInsuranceModificationInfo && this.personnelInsuranceModificationInfo.length > 0) {
          console.log("存在人员参保变更信息查询(人社局)")
          identityData.push({
            id: 'personnelInsuranceModification',
            title: '人员参保变更信息查询(人社局)',
            content: `${this.personnelInsuranceModificationInfo || '未知人员参保变更信息查询(人社局)'}`
          });
        } else {
          identityData.push({
            id: 'personnelInsuranceModification',
            title: '人员参保变更信息查询(人社局)',
            content: '可查看',
          });
        }
      } else if (this.isPersonnelInsuranceModificationError) {
        identityData.push({
          id: 'personnelInsuranceModification',
          title: '人员参保变更信息查询(人社局)',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'personnelInsuranceModification',
          title: '人员参保变更信息查询(人社局)',
          content: '暂无'
        });
      }
      //工伤认定结果信息查询(人社局)
      if (this.isWorkInjuryRecognitionLoaded) {
        if (this.workInjuryRecognitionInfo && this.workInjuryRecognitionInfo.length > 0) {
          console.log("存在工伤认定结果信息查询(人社局)")
          identityData.push({
            id: 'workInjuryRecognition',
            title: '工伤认定结果信息查询(人社局)',
            content: `${this.workInjuryRecognitionInfo || '未知工伤认定结果信息查询(人社局)'}`
          });
        } else {
          identityData.push({
            id: 'workInjuryRecognition',
            title: '工伤认定结果信息查询(人社局)',
            content: '可查看',
          });
        }
      } else if (this.isWorkInjuryRecognitionError) {
        identityData.push({
          id: 'workInjuryRecognition',
          title: '工伤认定结果信息查询(人社局)',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'workInjuryRecognition',
          title: '工伤认定结果信息查询(人社局)',
          content: '暂无'
        });
      }
      // 工伤待遇支付明细查询(人社局)
      if (this.isInjuryPaymentDetailLoaded) {
        if (this.injuryPaymentDetailInfo && this.injuryPaymentDetailInfo.length > 0) {
          console.log("存在工伤待遇支付明细查询(人社局)")
          identityData.push({
            id: 'injuryPaymentDetail',
            title: '工伤待遇支付明细查询(人社局)',
            content: `${this.injuryPaymentDetailInfo || '未知工伤待遇支付明细查询(人社局)'}`
          });
        } else {
          identityData.push({
            id: 'injuryPaymentDetail',
            title: '工伤待遇支付明细查询(人社局)',
            content: '可查看',
          });
        }
      } else if (this.isInjuryPaymentDetailError) {
        identityData.push({
          id: 'injuryPaymentDetail',
          title: '工伤待遇支付明细查询(人社局)',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'injuryPaymentDetail',
          title: '工伤待遇支付明细查询(人社局)',
          content: '暂无'
        });
      }
      //养老生存认证查询(人社局)
      if (this.isPensionSurvivalAuthenticationLoaded) {
        if (this.pensionSurvivalAuthenticationInfo && this.pensionSurvivalAuthenticationInfo.length > 0) {
          console.log("存在养老生存认证查询(人社局)")
          identityData.push({
            id: 'pensionSurvivalAuthentication',
            title: '养老生存认证查询(人社局)',
            content: `${this.pensionSurvivalAuthenticationInfo || '未知养老生存认证查询(人社局)'}`
          });
        } else {
          identityData.push({
            id: 'pensionSurvivalAuthentication',
            title: '养老生存认证查询(人社局)',
            content: '可查看',
          });
        }
      } else if (this.isPensionSurvivalAuthenticationError) {
        identityData.push({
          id: 'pensionSurvivalAuthentication',
          title: '养老生存认证查询(人社局)',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'pensionSurvivalAuthentication',
          title: '养老生存认证查询(人社局)',
          content: '暂无'
        });
      }
      // 医疗长期居外或异地安置人员基本信息
      if (this.isMedicalPersonLoaded) {
        if (this.medicalPersonInfo && this.medicalPersonInfo.length > 0) {
          console.log("医疗长期居外或异地安置人员基本信息")
          identityData.push({
            id: 'medicalPerson',
            title: '医疗长期居外或异地安置人员基本信息',
            content: `${this.medicalPersonInfo || '未知医疗长期居外或异地安置人员基本信息'}`
          });
        } else {
          identityData.push({
            id: 'medicalPerson',
            title: '医疗长期居外或异地安置人员基本信息',
            content: '可查看',
          });
        }
      } else if (this.isMedicalPersonError) {
        identityData.push({
          id: 'medicalPerson',
          title: '医疗长期居外或异地安置人员基本信息',
          content: '可查看',
        });
      } else {
        identityData.push({
          id: 'medicalPerson',
          title: '医疗长期居外或异地安置人员基本信息',
          content: '暂无'
        });
      }
      return identityData;
    },
    propertyRight() {
      const propertyData = [];

      // 房产信息 - 从 realEstateInfo 中提取
      if (this.isQueryIdLoaded) {
        if (this.realEstateInfo && this.realEstateInfo.length > 0) {
          let totalbuildingArea = 0;
          let totalMortgageAmount = 0;
          let seizedCount = 0;
          let notSeizedCount = 0;

          this.realEstateInfo.forEach((item) => {
            if (item.buildingArea) {
              totalbuildingArea += parseFloat(item.buildingArea) || 0;
            }
            if (item.mortgageAmount) {
              totalMortgageAmount += parseFloat(item.mortgageAmount) || 0;
            }
            if (item.isSeized === "是" || item.isSeized === 1 || item.isSeized === true) {
              seizedCount++;
            } else {
              notSeizedCount++;
            }
          });

          let estateContent = `共${this.realEstateInfo.length}处房产`;
          if (totalbuildingArea > 0) {
            estateContent += `，总占地${totalbuildingArea.toFixed(2)}㎡`;
          }
          if (totalMortgageAmount > 0) {
            estateContent += `，总抵押${totalMortgageAmount.toFixed(2)}万元`;
          }
          estateContent += `，其中${seizedCount}处被查封，${notSeizedCount}处未查封`;

          propertyData.push({
            id: "estate",
            title: "房产信息",
            content: estateContent,
          });
        } else {
          propertyData.push({
            id: "estate",
            title: "房产信息",
            content: "可查看",
          });
        }
      } else if (this.isQueryIdError) {
        propertyData.push({
          id: "estate",
          title: "房产信息",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "estate",
          title: "房产信息",
          content: "暂无",
        });
      }

      // 银行卡信息
      if (this.isBankAccountLoaded) {
        if (this.bankCardInfo && this.bankCardInfo.length > 0) {
          const totalBalance = this.bankCardInfo.reduce((sum, card) => {
            const balance = parseFloat(card.balance) || 0;
            return sum + balance;
          }, 0);

          propertyData.push({
            id: "bank",
            title: "银行卡信息",
            content: `共${this.bankCardInfo.length}张银行卡，总余额：${totalBalance.toFixed(
                2
            )}元`,
          });
        } else {
          propertyData.push({
            id: "bank",
            title: "银行卡信息",
            content: "可查看",
          });
        }
      } else if (this.isBankAccountError) {
        propertyData.push({
          id: "bank",
          title: "银行卡信息",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "bank",
          title: "银行卡信息",
          content: "暂无",
        });
      }

      // 居民待遇信息
      if (this.isResidentDistributionLoaded) {
        if (this.residentDistributionInfo && this.residentDistributionInfo.length > 0) {
          console.log("存在居民待遇信息")
          propertyData.push({
            id: 'residentDistribution',
            title: '居民待遇信息',
            content: `共 ${this.residentDistributionInfo.length} 条记录。`,
          });
        } else {
          propertyData.push({
            id: "residentDistribution",
            title: "居民待遇信息",
            content: "可查看",
          });
        }
      } else if (this.isResidentDistributionError) {
        propertyData.push({
          id: "residentDistribution",
          title: "居民待遇信息",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "residentDistribution",
          title: "居民待遇信息",
          content: "暂无",
        });
      }
      // 个人缴费信息
      if (this.isPaymentInfoLoaded){
        if (this.personalPaymentInfo && this.personalPaymentInfo.length > 0){
          console.log("存在个人缴费信息")
          propertyData.push({
            id: 'personalPayment',
            title: '个人缴费信息',
            content: `共 ${this.personalPaymentInfo.length} 条记录。`,
          });
        }else {
          propertyData.push({
            id: "personalPayment",
            title: "个人缴费信息",
            content: "可查看",
          });
        }
      }else if (this.isPaymentInfoError){
        propertyData.push({
          id: "personalPayment",
          title: "个人缴费信息",
          content: "可查看",
        });
      }else {
        propertyData.push({
          id: "personalPayment",
          title: "个人缴费信息",
          content: "暂无",
        });
      }
      // 其他财产
      const otherPropertyItems = [];

      // 企业信息
      if (this.isPersonEnterpriseLoaded) {
        if (this.personEnterpriseInfo && this.personEnterpriseInfo.length > 0) {
          let revokedCount = 0;
          let activeCount = 0;
          let abnormalCount = 0;

          this.personEnterpriseInfo.forEach((item) => {
            const status = item.enterpriseStatus || "";
            const isException = item.isException || "";

            if (status.includes("吊销")) {
              revokedCount++;
            } else {
              activeCount++;
            }

            if (isException.includes("异常")) {
              abnormalCount++;
            }
          });

          let enterpriseContent = `拥有${this.personEnterpriseInfo.length}家企业`;
          if (revokedCount > 0) {
            enterpriseContent += `，其中${revokedCount}家已吊销`;
          }
          if (activeCount > 0) {
            enterpriseContent += `，${activeCount}家在业`;
          }
          if (abnormalCount > 0) {
            enterpriseContent += `，${abnormalCount}家列为异常`;
          }

          otherPropertyItems.push(enterpriseContent);
        } else {
          otherPropertyItems.push("可查看企业信息");
        }
      } else if (this.isPersonEnterpriseError) {
        otherPropertyItems.push("可查看企业信息");
      } else {
        otherPropertyItems.push("暂无企业信息");
      }

      // 公积金信息
      if (this.isHousingFundLoaded) {
        if (this.housingFundInfo && this.housingFundInfo.length > 0) {
          let housingFundTotal = 0;
          let housingFundCount = this.housingFundInfo.length;

          housingFundTotal = this.housingFundInfo.reduce((sum, fund) => {
            const balance = parseFloat(fund.balance) || 0;
            return sum + balance;
          }, 0);

          otherPropertyItems.push(
              `拥有${housingFundCount}个公积金账户，总余额：${housingFundTotal.toFixed(2)}元`
          );
        } else {
          otherPropertyItems.push("可查看公积金信息");
        }
      } else if (this.isHousingFundError) {
        otherPropertyItems.push("可查看公积金信息");
      } else {
        otherPropertyItems.push("暂无公积金信息");
      }

      // 金融货币信息
      if (this.isFinancialLoaded) {
        if (this.financialInfo && this.financialInfo.length > 0) {
          const financialNames = this.financialInfo.map(
              (item) => item.assetName || "未知资产"
          );
          const uniqueFinancialNames = [...new Set(financialNames)];

          otherPropertyItems.push(
              `拥有${this.financialInfo.length}个金融资产：${uniqueFinancialNames.join("、")}`
          );
        } else {
          otherPropertyItems.push("可查看金融资产信息");
        }
      } else if (this.isFinancialError) {
        otherPropertyItems.push("可查看金融资产信息");
      } else {
        otherPropertyItems.push("暂无金融资产信息");
      }

      if (otherPropertyItems.length > 0 && otherPropertyItems.some(item => !item.includes("暂无"))) {
        propertyData.push({
          id: "other",
          title: "其他财产",
          content: otherPropertyItems.filter(item => !item.includes("暂无")).join("；"),
        });
      } else if (otherPropertyItems.length > 0) {
        propertyData.push({
          id: "other",
          title: "其他财产",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "other",
          title: "其他财产",
          content: "暂无",
        });
      }

      return propertyData;
    },

    propertyRight2() {
      const propertyData = [];

      // 二手房交易信息
      if (this.isSecondHandHouseLoaded) {
        if (this.secondHandHouseData && this.secondHandHouseData.length > 0) {
          propertyData.push({
            id: "secondHandHouse",
            title: "二手房交易",
            content: `共 ${this.secondHandHouseData.length} 条交易记录`,
          });
        } else {
          propertyData.push({
            id: "secondHandHouse",
            title: "二手房交易",
            content: "可查看",
          });
        }
      } else if (this.isSecondHandHouseError) {
        propertyData.push({
          id: "secondHandHouse",
          title: "二手房交易",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "secondHandHouse",
          title: "二手房交易",
          content: "暂无",
        });
      }

      // 房屋权属(接口获取)信息
      if (this.isHouseOwnershipLoaded) {
        if (this.houseOwnershipData && this.houseOwnershipData.length > 0) {
          propertyData.push({
            id: "houseOwnership",
            title: "房屋权属",
            content: `共${this.houseOwnershipData.length}处权属记录`,
          });
        } else {
          propertyData.push({
            id: "houseOwnership",
            title: "房屋权属",
            content: "可查看",
          });
        }
      } else if (this.isHouseOwnershipError) {
        propertyData.push({
          id: "houseOwnership",
          title: "房屋权属",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "houseOwnership",
          title: "房屋权属",
          content: "暂无",
        });
      }

      // 全市有无房(接口获取)信息
      if (this.isCityHouseLoaded) {
        if (this.cityHouseData && this.cityHouseData.length > 0) {
          propertyData.push({
            id: "cityHouse",
            title: "全市有无房",
            content: `共${this.cityHouseData.length}处房产`,
          });
        } else {
          propertyData.push({
            id: "cityHouse",
            title: "全市有无房",
            content: "可查看",
          });
        }
      } else if (this.isCityHouseError) {
        propertyData.push({
          id: "cityHouse",
          title: "全市有无房",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "cityHouse",
          title: "全市有无房",
          content: "暂无",
        });
      }

      // 两客一危(接口获取)信息
      if (this.isCrossCarLoaded) {
        if (this.crossCarInfo && this.crossCarInfo.length > 0) {
          propertyData.push({
            id: "crossCar",
            title: "两客一危",
            content: `共${this.crossCarInfo.length}辆`,
          });
        } else {
          propertyData.push({
            id: "crossCar",
            title: "两客一危",
            content: "可查看",
          });
        }
      } else if (this.isCrossCarError) {
        propertyData.push({
          id: "crossCar",
          title: "两客一危",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "crossCar",
          title: "两客一危",
          content: "暂无",
        });
      }
      // 车辆信息
      if (this.isVehicleLoaded) {
        if (this.vehicleInfo && this.vehicleInfo.length > 0) {
          let vehicleDetails = this.vehicleInfo
              .map((v) => `${v.brandZh || "未知品牌"} ${v.plateNo || "未知车牌"}`)
              .join("；");

          propertyData.push({
            id: "vehicle",
            title: "车辆信息",
            content: `共${this.vehicleInfo.length}辆车：${vehicleDetails}`,
          });
        } else {
          propertyData.push({
            id: "vehicle",
            title: "车辆信息",
            content: "可查看",
          });
        }
      } else if (this.isVehicleError) {
        propertyData.push({
          id: "vehicle",
          title: "车辆信息",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "vehicle",
          title: "车辆信息",
          content: "暂无",
        });
      }
      // 船舶信息(接口获取)信息
      if (this.isShipLoaded) {
        if (this.shipInfo && this.shipInfo.length > 0) {
          propertyData.push({
            id: "ship",
            title: "船舶信息",
            content: `共${this.shipInfo.length}艘`,
          });
        } else {
          propertyData.push({
            id: "ship",
            title: "船舶信息",
            content: "可查看",
          });
        }
      } else if (this.isShipError) {
        propertyData.push({
          id: "ship",
          title: "船舶信息",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "ship",
          title: "船舶信息",
          content: "暂无",
        });
      }
      // 家庭适龄学生资助减免信息
      if (this.isstudentassistLoaded) {
        if (this.studentassistInfo && this.studentassistInfo.length > 0) {
          propertyData.push({
            id: "studentassist",
            title: "家庭适龄学生资助减免信息",
            content: `共${this.studentassistInfo.length}条`,
          });
        } else {
          propertyData.push({
            id: "studentassist",
            title: "家庭适龄学生资助减免信息",
            content: "可查看",
          });
        }
      } else if (this.isstudentassistError) {
        propertyData.push({
          id: "studentassist",
          title: "家庭适龄学生资助减免信息",
          content: "可查看",
        });
      } else {
        propertyData.push({
          id: "studentassist",
          title: "家庭适龄学生资助减免信息",
          content: "暂无",
        });
      }

      return propertyData;
    },


    consumptionLeft() {
      const consumptionData = [];

      // 快递信息 - 设置为暂无且禁用
      consumptionData.push({
        id: "express",
        title: "快递信息",
        content: "暂无"
      });

      // 外卖信息 - 设置为暂无且禁用
      consumptionData.push({
        id: "takeout",
        title: "外卖信息",
        content: "暂无"
      });

      // 网购信息
      if (this.isMeituanLoaded) {
        if (this.meituanData && this.meituanData.orderCount !== undefined) {
          consumptionData.push({
            id: "online",
            title: "网购信息",
            content: `共${this.meituanData.orderCount}条外卖记录`,
          });
        } else if (this.meituanData && this.meituanData.mostFrequentAddress) {
          consumptionData.push({
            id: "online",
            title: "网购信息",
            content: "常以外卖地址作为居住地参考",
          });
        } else {
          consumptionData.push({
            id: "online",
            title: "网购信息",
            content: "可查看",
          });
        }
      } else if (this.isMeituanError) {
        consumptionData.push({
          id: "online",
          title: "网购信息",
          content: "可查看",
        });
      } else {
        consumptionData.push({
          id: "online",
          title: "网购信息",
          content: "暂无",
        });
      }
      return consumptionData;
    },

    actionRight() {
      const actionData = [];

      // 居住地
      if (this.isMeituanLoaded) {
        if (this.meituanData && this.meituanData.mostFrequentAddress) {
          actionData.push({
            id: "residence",
            title: "居住地",
            content: `常住地址：${this.meituanData.mostFrequentAddress}`,
          });
        } else {
          actionData.push({
            id: "residence",
            title: "居住地",
            content: "可查看",
          });
        }
      } else if (this.isMeituanError) {
        actionData.push({
          id: "residence",
          title: "居住地",
          content: "可查看",
        });
      } else {
        actionData.push({
          id: "residence",
          title: "居住地",
          content: "暂无",
        });
      }

      // 高频地址信息
      if (this.isSelfAddressFrequencyLoaded) {
        if (this.selfAddressFrequency && this.selfAddressFrequency.length > 0) {
          this.selfAddressFrequency.sort((a, b) => b.frequency - a.frequency);
          const highestFrequencyAddress = this.selfAddressFrequency[0];
          const address =
              highestFrequencyAddress.recAddress ||
              highestFrequencyAddress.address ||
              "未知地址";
          const frequency = highestFrequencyAddress.frequency || 0;

          actionData.push({
            id: "frequent",
            title: "高频地址信息",
            content: `高频地址: ${address} 频次: ${frequency}次`,
          });
        } else {
          actionData.push({
            id: "frequent",
            title: "高频地址信息",
            content: "可查看",
          });
        }
      } else if (this.isSelfAddressFrequencyError) {
        actionData.push({
          id: "frequent",
          title: "高频地址信息",
          content: "可查看",
        });
      } else {
        actionData.push({
          id: "frequent",
          title: "高频地址信息",
          content: "暂无",
        });
      }

      actionData.push({
        id: "recent",
        title: "近期活动区域",
        content: "暂无数据",
      });

      return actionData;
    },

    relationLeft() {
      const relationData = [];

      // 关联人
      if (this.isRelatedPeopleLoaded) {
        if (this.relatedPeople && this.relatedPeople.length > 0) {
          const relatedNames = this.relatedPeople
              .slice(0, 3)
              .map((person) => person.recName || "未知")
              .join("、");

          relationData.push({
            id: "related",
            title: "关联人",
            content: `共${this.relatedPeople.length}位关联人：${relatedNames}${this.relatedPeople.length > 3 ? "等" : ""
            }`,
          });
        } else {
          relationData.push({
            id: "related",
            title: "关联人",
            content: "可查看",
          });
        }
      } else if (this.isRelatedPeopleError) {
        relationData.push({
          id: "related",
          title: "关联人",
          content: "可查看",
        });
      } else {
        relationData.push({
          id: "related",
          title: "关联人",
          content: "暂无",
        });
      }

      // 关联财产
      if (this.isQueryIdLoaded) {
        if (this.coOwnershipInfo && this.coOwnershipInfo !== "未知") {
          relationData.push({
            id: "relatedProperty",
            title: "涉企信息",
            content: this.coOwnershipInfo,
          });
        } else {
          relationData.push({
            id: "relatedProperty",
            title: "涉企信息",
            content: "可查看",
          });
        }
      } else if (this.isQueryIdError) {
        relationData.push({
          id: "relatedProperty",
          title: "涉企信息",
          content: "可查看",
        });
      } else {
        relationData.push({
          id: "relatedProperty",
          title: "涉企信息",
          content: "暂无",
        });
      }

      return relationData;
    },
  },
  methods: {
    // 切换各节点的展开/折叠状态
    toggleIdentity() {
      this.isIdentityOpen = !this.isIdentityOpen;
      this.adjustLayout();
    },
    toggleProperty() {
      this.isPropertyOpen = !this.isPropertyOpen;
      this.adjustLayout();
    },
    toggleConsumption() {
      this.isConsumptionOpen = !this.isConsumptionOpen;
      this.adjustLayout();
    },
    toggleAction() {
      this.isActionOpen = !this.isActionOpen;
      this.adjustLayout();
    },
    toggleRelation() {
      this.isRelationOpen = !this.isRelationOpen;
      this.adjustLayout();
    },
    // 调整布局确保内容可见
    adjustLayout() {
      // 触发重排和重绘
      this.$nextTick(() => {
        // 计算所需高度并设置
        this.calculateRequiredHeight();
      });
    },

    // 计算所需高度并调整容器
    calculateRequiredHeight() {
      const fishbone = this.$el.querySelector(".fishbone");
      const container = this.$el.querySelector(".fishbone-wrapper");
      const contentWrapper = this.$el.querySelector(".content-wrapper");

      if (fishbone && container && contentWrapper) {
        // 获取上下分支的最大高度
        const expandUpNodes = this.$el.querySelectorAll(".expand-up .branches:visible");
        const expandDownNodes = this.$el.querySelectorAll(
            ".expand-down .branches:visible"
        );

        // 计算上部分支总高度
        let maxUpHeight = 0;
        expandUpNodes.forEach((node) => {
          const height = node.offsetHeight;
          if (height > maxUpHeight) maxUpHeight = height;
        });

        // 计算下部分支总高度
        let maxDownHeight = 0;
        expandDownNodes.forEach((node) => {
          const height = node.offsetHeight;
          if (height > maxDownHeight) maxDownHeight = height;
        });

        // 主节点高度（圆形直径）
        const nodeHeight = 110;

        // 计算所需总高度（上下分支高度 + 主节点高度 + 额外边距）
        const requiredHeight = maxUpHeight + maxDownHeight + nodeHeight + 100;

        // 设置最小高度，确保所有内容可见
        const finalHeight = Math.max(requiredHeight, 600);
        container.style.minHeight = `${finalHeight}px`;
        contentWrapper.style.minHeight = `${finalHeight}px`;

        // 确保没有缩放
        fishbone.style.transform = "scale(1)";
      }
    },
    showPdf(base64Data) {
      // 去掉 data URI 前缀
      const base64 = base64Data.replace(/^data:application\/pdf;base64,/, '');

      try {
        const byteCharacters = atob(base64);
        const byteNumbers = new Array(byteCharacters.length);
        for (let i = 0; i < byteCharacters.length; i++) {
          byteNumbers[i] = byteCharacters.charCodeAt(i);
        }
        const byteArray = new Uint8Array(byteNumbers);
        const blob = new Blob([byteArray], {type: 'application/pdf'});

        const url = URL.createObjectURL(blob);
        window.open(url, '_blank');
      } catch (e) {
        console.error('Base64 解码失败:', e);
      }
    },


    // 将PDF的base64数据合并到房屋本数据
    mergePdfIntoHouseData(houseData, pdfData) {
      if (!Array.isArray(houseData) || !Array.isArray(pdfData)) {
        console.warn('mergePdfIntoHouseData: 参数必须是数组');
        return houseData;
      }

      // 构建 PDF 映射表
      const pdfMap = new Map();
      pdfData.forEach(item => {
        const bdcdyh = item.certinfoextension?.bdcdyh;
        const file = item.certinfoextension?.file;
        if (bdcdyh && file) {
          pdfMap.set(bdcdyh, file);
        }
      });

      // 合并数据
      return houseData.map(house => {
        const bdcdyh = house.bdcdyh;
        const file = pdfMap.get(bdcdyh) || null;
        return {
          ...house,
          file
        };
      });
    },
    // 加载数据
    async loadData() {

      console.log(
          "身份证号:", this.idNumber,
          "姓名:", this.name,
          "手机号:", this.phone
      );
      // this.mergePDF = this.mergePdfIntoHouseData(this.houseOwnershipData, this.housePDF)
      // console.log("PDFFFFFFFF:----",this.mergePDF)

      // 1. 加载主要数据
      await axios.post(
          "/api/query/id",
          {idNumber: this.idNumber}
      ).then(res => {
        const data = res.data.data;
        console.log("主要数据返回:", data);
        this.usageInfo = data.usageInfo || [];
        this.shipInfo = data.shipInfo || [];
        this.residentInfo = data.residentInfo || [];
        this.letterInfo = data.letterInfo || [];
        this.caseInfo = data.caseInfo || [];
        this.realEstateInfo = this.deduplicateRealEstate(data.realEstateInfo) || [];
        this.realEstateInfo.forEach(item => {
          this.globalStore.mergeAddress({
            address: item.address,
            source: '房产',
            time: null
          });
        });
        this.familyInfo = data.familyInfo || [];
        this.specialEvents = data.specialEvents || [];
        const coOwnershipCount = this.realEstateInfo.filter(
            (item) => item.coOwnershipStatus === "有"
        ).length;
        this.coOwnershipInfo =
            coOwnershipCount > 0 ? `${coOwnershipCount}处共有房产` : "暂无关联财产";
        console.log(this.coOwnershipInfo);
        this.isQueryIdLoaded = true;
      }).catch(e => {
        console.error("主要数据加载失败:", e);
        this.isQueryIdError = true;
        this.isQueryIdLoaded = true;
      });

      // 2. 加载关联人数据
      await axios.post(
          "/api/relatedPeople/all",
          {phone: this.phone}
      ).then(res => {
        console.log("关联人数据返回:", res);
        this.relatedPeople = res.data.result || [];
        this.isRelatedPeopleLoaded = true;
      }).catch(e => {
        console.error("关联人数据加载失败:", e);
        this.isRelatedPeopleError = true;
        this.isRelatedPeopleLoaded = true;
      });

      // 3. 加载美团数据
      await axios.post(
          "/api/caseInformation/summon",
          {
            executor: this.name,
            phone: this.phone,
            idNumber: this.idNumber,
          }
      ).then(res => {
        console.log("美团数据返回:", res);
        this.meituanData = res.data || {};
        if (this.meituanData) {
          this.globalStore.mergeAddress({
            address: this.meituanData.mostFrequentAddress, // 取对象里的字段
            source: '京东',
            time: this.meituanData.mostFrequentTime        // 取对象里的字段
          });
        }
        this.isMeituanLoaded = true;
      }).catch(e => {
        console.error("美团数据加载失败:", e);
        this.isMeituanError = true;
        this.isMeituanLoaded = true;
      });

      // 4. 加载个人企业信息
      axios.post(
          "/api/personEnterprise/info",
          {idNumber: this.idNumber}
      ).then(res => {
        console.log("个人企业信息返回:", res);
        this.personEnterpriseInfo = res.data.data || [];
        this.isPersonEnterpriseLoaded = true;
      }).catch(e => {
        console.error("个人企业信息加载失败:", e);
        this.isPersonEnterpriseError = true;
        this.isPersonEnterpriseLoaded = true;
      });

      // 5. 加载本人地址交互频次数据
      await axios.post(
          "/api/meituan/selfAddressFrequency",
          {phone: this.phone}
      ).then(res => {
        console.log("本人地址交互频次返回:", res);
        this.selfAddressFrequency = res.data.data || [];
        if (this.selfAddressFrequency.length > 0){
          this.selfAddressFrequency.forEach(item => {
            this.globalStore.mergeAddress({
              address: item.recAddress,
              source: '京东',
              time: null,
              frq: item.frequency
            });
          });
        }
        this.isSelfAddressFrequencyLoaded = true;
      }).catch(e => {
        console.error("本人地址交互频次加载失败:", e);
        this.isSelfAddressFrequencyError = true;
        this.isSelfAddressFrequencyLoaded = true;
      });

      // 6. 加载银行卡信息
      await axios.post(
          "/api/bankAccountInfo/findByIdNumber",
          {
            idNumber: this.idNumber,
          }
      ).then(res => {
        console.log("银行卡信息返回:", res);
        this.bankCardInfo = res.data.data || [];
        if (this.bankCardInfo.length > 0){
          this.bankCardInfo.forEach(item=>{
            this.globalStore.mergeAddress({
              address: item.postalAddress,
              source: '银行卡',
              time: null,
            });
          });
        }
        this.isBankAccountLoaded = true;
      }).catch(e => {
        console.error("银行卡信息加载失败:", e);
        this.isBankAccountError = true;
        this.isBankAccountLoaded = true;
      });

      // 7. 加载车辆信息（仅接口）
      await axios.post("/api/external/carInformation", {
        idNumber: this.idNumber,
      }).then(res => {
        console.log("车辆信息返回:", res);
        this.vehicleInfo = res.data.data.datas || [];
        this.isVehicleLoaded = true;
      }).catch(e => {
        console.error("车辆信息加载失败:", e);
        this.isVehicleError = true;
        this.isVehicleLoaded = true;
      });

      // 8. 加载社保信息
      await axios.post("/api/socialSecurityInfo/findByIdNumber", {
        idNumber: this.idNumber,
      }).then(res => {
        console.log("社保信息返回:", res);
        this.socialSecurityInfo = res.data.data || [];
        this.isSocialSecurityLoaded = true;
      }).catch(e => {
        console.error("社保信息加载失败:", e);
        this.isSocialSecurityError = true;
        this.isSocialSecurityLoaded = true;
      });

      // 9. 获取美团订单数量
      await axios.post(
          "/api/meituan/orderDetails",
          {
            phone: this.phone,
          }
      ).then(res => {
        console.log("美团订单数量返回:", res);
        if (res.data.code === 200) {
          if (this.meituanData) {
            this.meituanData.orderCount = res.data.data || 0;
            if (this.meituanData.orderCount.length > 0){
              this.meituanData.orderCount.forEach(item=>{
                this.globalStore.mergeAddress({
                  address: item.recAddress,
                  source: '京东',
                  time: item.lastActiveTime,
                });
              })
            }
          } else {
            this.meituanData = {orderCount: res.data.data || 0};
          }
        }
        this.isMeituanOrderLoaded = true;
      }).catch(e => {
        console.error("美团订单数量加载失败:", e);
        this.isMeituanOrderError = true;
        this.isMeituanOrderLoaded = true;
      });

      //10.婚姻信息
      if (this.globalStore.isMarriageOpen){
        console.log("this.globalStore.isMarriageOpen",this.globalStore.isMarriageOpen)
        const marriageFormData = new FormData();
        marriageFormData.append("name", this.name);
        marriageFormData.append("idNumber", this.idNumber);
        await axios.post(
            "/api/external/marriage",
            marriageFormData
        ).then(res => {
          console.log("婚姻信息返回", res);
          const data = res.data?.data?.data || [];
          if (Array.isArray(data)) {
            this.marriageInfo = data;
          } else {
            this.marriageInfo = [data];
          }
          this.isMarriageInfoLoaded = true;
          console.log("婚姻信息", this.marriageInfo);
        }).catch(e => {
          console.error("婚姻信息加载失败:", e);
          this.isMarriageInfoError = true;
        });
      }else {
        console.log("婚姻信息当前不对您开放")
      }


      // 11. 加载公积金信息
      await axios.post(
          "/api/housingFundInfo/findByIdNumber",
          {
            idNumber: this.idNumber,
          }
      ).then(res => {
        console.log("公积金信息返回:", res);
        this.housingFundInfo = res.data.data || [];
        this.isHousingFundLoaded = true;
      }).catch(e => {
        console.error("公积金信息加载失败:", e);
        this.isHousingFundError = true;
        this.isHousingFundLoaded = true;
      });

      // 12. 加载金融资产信息
      const financialResponse = await axios.post("/api/financialInfo/findByIdNumber", {
        idNumber: this.idNumber,
      }).then(res => {
        console.log("金融资产信息返回:", res);
        this.financialInfo = res.data.data || [];
        this.isFinancialLoaded = true;
      }).catch(e => {
        console.error("金融资产信息加载失败:", e);
        this.isFinancialError = true;
        this.isFinancialLoaded = true;
      });

      // 13. 加载美团订单详情
      await axios.post(
          "/api/meituan/orderDetails",
          {
            phone: this.phone
          }
      ).then(res => {
        console.log("美团订单详情返回:", res);
        if (res.data.code === 200) {
          this.meituanOrderList = res.data.data || [];
        }
        this.isMeituanOrderLoaded = true;
      }).catch(e => {
        console.error("美团订单详情加载失败:", e);
        this.isMeituanOrderError = true;
        this.isMeituanOrderLoaded = true;
      });

      // 14. 户籍信息
      await axios.post("/api/personInfo/findByIdNumber", {
        idNumber: this.idNumber,
      }).then(res => {
        console.log("户籍信息返回:", res);
        if (
            res.data.code === 200 &&
            res.data.data.length > 0
        ) {
          this.personalInfo = res.data.data[0];
        }
        this.isPersonInfoLoaded = true;
      }).catch(e => {
        console.error("户籍信息加载失败:", e);
        this.personalInfo = {};
        this.isPersonInfoError = true;
        this.isPersonInfoLoaded = true;
      });
      const personInfoResponse = await axios.post("/api/personInfo/findByIdNumber", {
        idNumber: this.idNumber,
      });
      // 15. 从接口获取驾驶证信息
      // 请求参数
      const driverJsonData = {
        "userInfo": {
          "departmentCode": "11320700K12498593B",
          "tokenCode": "000001910700518"
        },
        "params": {"HOLDER_NAME": {"value": this.name}}
      };
      // FormData格式
      const driverFormData = new FormData();
      driverFormData.append('jsonData', JSON.stringify(driverJsonData));
      await axios({
        url: "http://172.19.241.8:18110/datashare/getRequestData/1000008",
        method: "GET",
        params: {
          jsonData: driverFormData.get("jsonData")
        }
      }).then(res => {
        console.log("驾驶证信息返回:", res);
        this.driveLicenceInfo = res.data.datas || [];
        this.isDriveLicenceLoaded = true;
      }).catch(e => {
        console.error("驾驶证信息加载失败:", e);
        this.isDriveLicenceError = true;
        this.isDriveLicenceLoaded = true;
      });
      // 16. 加载二手房交易数据
      await axios.post(
          "/api/external/secondHandHouse",
          {
            name: this.name,
            idNumber: this.idNumber,
          }
      )
          .then(res => {
            console.log("二手房交易返回数据:", res);
            const data = res.data?.data?.data?.fcjyClfMmht || [];
            console.log("二手房交易数据", data);
            this.secondHandHouseData = data;
            this.secondHandHouseData.forEach(item => {
              this.globalStore.mergeAddress({
                address: item.FWZL,
                source: '房产',
                time: item.QDRQ
              });
            });
            this.isSecondHandHouseLoaded = true;
          })
          .catch(e => {
            console.error("二手房交易数据加载失败:", e);
            this.isSecondHandHouseError = true;
            this.isSecondHandHouseLoaded = true;
            this.secondHandHouseData = [];
          });

      // 17. 加载房屋权属(接口获取)数据
      await axios.post(
          "/api/external/houseOwnership",
          {
            name: this.name,
            idNumber: this.idNumber,
          }
      )
          .then(res => {
            console.log("房屋权属返回数据:", res);
            const data = res?.data?.data?.data?.qllist || [];
            console.log("房屋权属数据", data);
            this.houseOwnershipData = data;
            this.houseOwnershipData.forEach(item=>{
              this.globalStore.mergeAddress({
                address: item.fwzl,
                source: '房产',
                time: item.cdsj
              });
            });
            this.isHouseOwnershipLoaded = true;
          })
          .catch(e => {
            console.error("房屋权属数据加载失败:", e);
            this.isHouseOwnershipError = true;
            this.isHouseOwnershipLoaded = true;
            this.houseOwnershipData = [];
          });
      // 18. 不动产PDF数据
      await axios.post(
          "/api/external/realEstate",
          {
            idNumber: this.idNumber,
          }
      )
          .then(res => {
            console.log("不动产PDF返回数据:", res);
            const data = res?.data?.data?.custom?.info || [];
            console.log("不动产PDF", data);
            this.housePDF = data;
            this.mergePDF = this.mergePdfIntoHouseData(this.houseOwnershipData, this.housePDF)
          })
          .catch(e => {
            console.error("不动产PDF查询失败:", e);
            this.housePDF = [];
          });

      // 19. 加载全市有无房(接口获取)数据
      await axios.post(
          "/api/external/cityHouse",
          {
            name: this.name,
            idNumber: this.idNumber,
          }
      )
          .then(res => {
            console.log("全市有无房返回数据:", res);
            const data = res?.data?.data?.data?.fwlist || [];
            console.log("全市有无房数据", data);
            this.cityHouseData = data;
            this.cityHouseData.forEach(item=>{
              this.globalStore.mergeAddress({
                address: item.fwzl,
                source: '房产',
                time: item.cdsj
              });
            });
            this.isCityHouseLoaded = true;
          })
          .catch(e => {
            console.error("全市有无房数据加载失败:", e);
            this.isCityHouseError = true;
            this.isCityHouseLoaded = true;
            this.cityHouseData = [];
          });
      // 20. 加载高校学籍(接口获取)数据
      await axios.post(
          "/api/external/school",
          {
            name: this.name,
            idNumber: this.idNumber,
          }
      )
          .then(res => {
            console.log("高校学籍信息返回数据:", res);
            const data = res?.data?.data?.data || [];
            console.log("高校学籍信息", data);
            this.schoolInfo = data;
            this.isSchoolLoaded = true;
          })
          .catch(e => {
            console.error("高校学籍信息加载失败:", e);
            this.isSchoolError = true;
            this.isSchoolLoaded = true;
            this.schoolInfo = [];
          });

      // 21. 加载两客一危（接口获取）数据
      await axios.post(
          "/api/external/crossCar",
          {
            name: this.name,
          }
      )
          .then(res => {
            console.log("两客一危返回数据:", res);
            const data = res?.data?.data?.datas || [];
            console.log("两客一危信息", data);
            this.crossCarInfo = data;
            this.isCrossCarLoaded = true;
          })
          .catch(e => {
            console.error("两客一危信息加载失败:", e);
            this.isCrossCarError = true;
            this.isCrossCarLoaded = true;
            this.crossCarInfo = [];
          });

      // 22. 加载船舶（接口获取）数据
      await axios.post(
          "/api/external/shipInformation",
          {
            name: this.name,
          }
      )
          .then(res => {
            console.log("船舶返回数据:", res);
            const data = res?.data?.data?.datas || [];
            console.log("船舶信息", data);
            this.shipInfo = data;
            this.isShipLoaded = true;
          })
          .catch(e => {
            console.error("船舶信息加载失败:", e);
            this.isShipError = true;
            this.isShipLoaded = true;
            this.shipInfo = [];
          });
      // 23. 居民待遇（接口获取）数据
      await axios.post(
          "/api/external/residentDistribution",
          {
            name: this.name,
            idNumber: this.idNumber,
          }
      )
          .then(res => {
            console.log("居民待遇返回数据:", res);
            const data = res?.data?.data?.datas || [];
            console.log("居民待遇信息", data);
            this.residentDistributionInfo = data;
            this.isResidentDistributionLoaded = true;
          })
          .catch(e => {
            console.error("居民待遇信息加载失败:", e);
            this.isResidentDistributionError = true;
            this.isResidentDistributionLoaded = true;
            this.residentDistributionInfo = [];
          });
      // 24. 人员参保（医疗局，接口获取）数据
      if(this.globalStore.isHibpersonalInsuranceOpen){
        console.log("人员参保（医疗局）允许访问",this.globalStore.isHibpersonalInsuranceOpen);
        await axios.post(
            "/api/external/hib/personalInsurance",
            {
              idNumber: this.idNumber,
            }
        )
            .then(res => {
              console.log("人员参保（医疗局）返回数据:", res);
              const data = res?.data?.data?.data || [];
              console.log("人员参保（医疗局）信息", data);
              this.hibpersonalInsuranceInfo = data;
              this.ishibpersonalInsuranceLoaded = true;
            })
            .catch(e => {
              console.error("人员参保（医疗局）信息加载失败:", e);
              this.ishibpersonalInsuranceError = true;
              this.ishibpersonalInsuranceLoaded = true;
              this.hibpersonalInsuranceInfo = [];
            });
      }else {
        console.log("人员参保（医疗局）接口无权访问" );
      }

      // 25. 参保信息（医疗局，接口获取）数据
      if(this.globalStore.isSuredPersonOpen){
        console.log("参保信息（医疗局）允许访问",this.globalStore.isSuredPersonOpen);
        await axios.post(
            "/api/external/insuredPerson",
            {
              idNumber: this.idNumber,
            }
        )
            .then(res => {
              console.log("参保信息（医疗局）返回数据:", res);
              const data = res?.data?.data?.data || [];
              console.log("参保信息（医疗局）信息", data);
              this.insuredPersonInfo = data;
              if (this.insuredPersonInfo.length > 0){
                this.insuredPersonInfo.forEach(item=>{
                  this.globalStore.mergeAddress({
                    address: item.live_addr,
                    source: '参保信息（医疗局）居住地址',
                    time: null
                  });
                  this.globalStore.mergeAddress({
                    address: item.hsreg_addr,
                    source: '参保信息（医疗局）户籍地址',
                    time: null
                  });
                });
              }
              this.isinsuredPersonLoaded = true;
            })
            .catch(e => {
              console.error("参保信息（医疗局）信息加载失败:", e);
              this.isinsuredPersonError = true;
              this.isinsuredPersonLoaded = true;
              this.insuredPersonInfo = [];
            });
      }else {
        console.log("参保信息（医疗局）接口无权访问" );
      }
      // 26. 人员参保（人社局，接口获取）数据
      if (this.globalStore.isHrsspersonalInsuranceOpen){
        await axios.post(
            "/api/external/hrss/personalInsurance",
            {
              idNumber: this.idNumber,
              name: this.name,
            }
        )
            .then(res => {
              console.log("人员参保（人社局）返回数据:", res);
              const data = res?.data?.data || [];
              console.log("人员参保（人社局）信息", data);
              this.hrsspersonalInsuranceInfo = data;
              if (this.hrsspersonalInsuranceInfo.length > 0){
                this.hrsspersonalInsuranceInfo.forEach(item=>{
                  this.globalStore.mergeAddress({
                    address: item.AAB004,
                    source: '人员参保（人社局）信息',
                    time: item.AAC030
                  })
                })
              }
              this.ishrsspersonalInsuranceLoaded = true;
            })
            .catch(e => {
              console.error("人员参保（人社局）信息加载失败:", e);
              this.ishrsspersonalInsuranceError = true;
              this.ishrsspersonalInsuranceLoaded = true;
              this.hrsspersonalInsuranceInfo = [];
            });
      }else {
        console.log("人员参保（人社局）暂时不对您开放" );
      }

      // 27. 单位基本信息（人社局，接口获取）数据
      if (this.globalStore.isUnitInformationOpen){
        await axios.post(
            "/api/external/unitInformation",
            {
              idNumber: this.idNumber,
              name: this.name,
            }
        )
            .then(res => {
              console.log("单位基本信息（人社局）返回数据:", res);
              const data = res?.data?.data || [];
              console.log("单位基本信息（人社局）信息", data);
              this.unitInformationInfo = data;
              if (this.unitInformationInfo.length > 0){
                this.unitInformationInfo.forEach(item=>{
                  this.globalStore.mergeAddress({
                    address: item.BAB068,
                    source: '单位基本信息（人社局）',
                    time: null
                  })
                })
              }
              this.isunitInformationLoaded = true;
            })
            .catch(e => {
              console.error("单位基本信息（人社局）信息加载失败:", e);
              this.isunitInformationError = true;
              this.isunitInformationLoaded = true;
              this.unitInformationInfo = [];
            });
      }else {
        console.log("单位基本信息（人社局）暂时不对您开放" );
      }

      // 28. 人员基本信息（人社局，接口获取）数据
      if (this.globalStore.isPersonalInformationOpen){
        await axios.post(
            "/api/external/personalInformation",
            {
              idNumber: this.idNumber,
              name: this.name,
            }
        )
            .then(res => {
              console.log("人员基本信息（人社局）返回数据:", res);
              const data = res?.data?.data || [];
              console.log("人员基本信息（人社局）信息", data);
              this.personalInformationInfo = data;
              if (this.personalInformationInfo.length > 0){
                this.personalInformationInfo.forEach(item=>{
                  this.globalStore.mergeAddress({
                    address: item.AAE006,
                    source: '人员基本信息（人社局）',
                    time: null
                  })
                })
              }
              this.ispersonalInformationLoaded = true;
            })
            .catch(e => {
              console.error("人员基本信息（人社局）信息加载失败:", e);
              this.ispersonalInformationError = true;
              this.ispersonalInformationLoaded = true;
              this.personalInformationInfo = [];
            });
      }else {
        console.log("人员基本信息（人社局）暂时不对您开放" );
      }

      // 29. 个人缴费信息
      await axios.post(
          '/api/external/residentPayment',
          {idNumber: this.idNumber,
            name: this.name
          }
      ).then(res => {
        console.log("个人缴费信息返回数据：",res);
        const data = res?.data?.data || []
        console.log("个人缴费信息:",data);
        this.personalPaymentInfo = data;
        if (this.personalPaymentInfo.length > 0){
          this.personalPaymentInfo.forEach(item=>{
            this.globalStore.mergeAddress({
              address: item.AAB004,
              source: '人员缴费',
              time: item.AAE003
            });
          });
        }
        this.isPaymentInfoLoaded = true;
      }).catch( e => {
        console.error("个人缴费信息加载失败:", e);
        this.isPaymentInfoError = true;
        this.isPaymentInfoLoaded = true;
        this.personalPaymentInfo = [];
      })
      // 30. 低保对象信息
      if (this.globalStore.isSubsistenceAllowanceOpen){
        await axios.post(
            '/api/external/subsistenceAllowance',
            {idNumber: this.idNumber,
              name: this.name
            }
        ).then(res=>{
          console.log("低保对象信息返回：", res);
          if (res.data.code === 200){
            const rawData  = res?.data?.data?.data;
            const data = Array.isArray(rawData)
                ? rawData
                : (rawData && Object.keys(rawData).length > 0 ? [rawData] : []);
            console.log("低保对象信息:",data);
            this.subsistenceAllowanceInfo = data;
            if (this.subsistenceAllowanceInfo.length > 0){
              this.subsistenceAllowanceInfo.forEach(item=>{
                this.globalStore.mergeAddress({
                  address: item.dz,
                  source: '低保对象',
                  time: item.xsdbqsy
                });
              });
            }
            this.isSubsistenceAllowanceLoaded = true;
          }else {
            this.isSubsistenceAllowanceLoaded = true;
            this.isSubsistenceAllowanceError = true;
            this.subsistenceAllowanceInfo = [];
          }
        }).catch(e=>{
          console.error("低保对象信息返回加载失败:", e);
          this.isSubsistenceAllowanceError = true;
          this.isSubsistenceAllowanceLoaded = true;
          this.subsistenceAllowanceInfo = [];
        })
      }else {
        console.log("低保对象信息暂时不对您开放")
      }

      // 31. 社保卡信息
      if (this.globalStore.isSocialSecurityCardLOpen){
        await axios.post(
            '/api/external/socialSecurityCard',
            {idNumber: this.idNumber,
              name: this.name
            }
        ).then(res=>{
          console.log("返回社保卡信息：",res);
          if (res.data.code === 200){
            const rawData  = res?.data?.data;
            const data = Array.isArray(rawData)
                ? rawData
                : (rawData && Object.keys(rawData).length > 0 ? [rawData] : []);
            console.log("社保卡信息：",data);
            this.socialSecurityCardInfo = data;
            this.isSocialSecurityCardLoaded = true;
          }else {
            this.isSocialSecurityCardLoaded = true;
            this.isSocialSecurityCardError = true;
            this.socialSecurityCardInfo = [];
          }
        }).catch(e=>{
          console.log("社保卡信息加载失败：",e);
          this.isSocialSecurityCardLoaded = true;
          this.isSocialSecurityCardError = true;
          this.socialSecurityCardInfo = [];
        })
      }else {
        console.log("社保卡信息暂时不对您开放")
      }

      // 32. 企业退休人员信息（人社局）
      if (this.globalStore.isRetireOpen){
        await axios.post(
            '/api/external/retireeInformation',
            {idNumber: this.idNumber,
              name: this.name}
        ).then(res => {
          console.log("返回退休人员信息：",res);
          if (res.data.code === 200){
            const rawData  = res?.data?.data;
            const data = Array.isArray(rawData)
                ? rawData
                : (rawData && Object.keys(rawData).length > 0 ? [rawData] : []);
            console.log("退休人员信息：",data);
            this.retireInfo = data;
            this.isRetireLoaded = true;
          }else {
            this.retireInfo = [];
            this.isRetireLoaded = true;
            this.isRetireError = true;
          }
        }).catch(e=>{
          console.log("退休人员信息加载失败：",e);
          this.retireInfo = [];
          this.isRetireLoaded = true;
          this.isRetireError = true;
        })
      }else {
        console.log("企业退休人员信息暂时不对您开放")
      }

      // 33. 单位参保信息
      if (this.globalStore.isUnitInsuranceOpen){
        await axios.post(
            '/api/external/unitInsuranceInfo',
            {idNumber: this.idNumber,
              name: this.name}
        ).then(res => {
          console.log("返回单位参保信息：",res);
          if (res.data.code === 200){
            const rawData  = res?.data?.data;
            const data = Array.isArray(rawData)
                ? rawData
                : (rawData && Object.keys(rawData).length > 0 ? [rawData] : []);
            console.log("单位参保信息：",data);
            this.unitInsuranceInfo = data;
            if (this.unitInsuranceInfo.length > 0){
              this.unitInsuranceInfo.forEach(item=>{
                this.globalStore.mergeAddress({
                  address: item.AAB004,
                  source: '单位参保信息',
                  time: item.AAB050
                });
              });
            }
            this.isUnitInsuranceLoaded = true;
          }else {
            this.unitInsuranceInfo = [];
            this.isUnitInsuranceLoaded = true;
            this.isUnitInsuranceError = true;
          }
        }).catch(e=>{
          console.log("单位参保信息加载失败：",e);
          this.unitInsuranceInfo = [];
          this.isUnitInsuranceLoaded = true;
          this.isUnitInsuranceError = true;
        })
      }else {
        console.log("单位参保信息暂时不对您开放")
      }

      // 34. 人员参保变更信息（人社局）
      if (this.globalStore.isPersonnelInsuranceModificationOpen){
        await axios.post(
            '/api/external/personnelInsuranceModificationQuery',
            {idNumber: this.idNumber,
              name: this.name}
        ).then(res => {
          console.log("返回人员参保变更信息：",res);
          if (res.data.code === 200){
            const rawData  = res?.data?.data;
            const data = Array.isArray(rawData)
                ? rawData
                : (rawData && Object.keys(rawData).length > 0 ? [rawData] : []);
            console.log("人员参保变更信息：",data);
            this.personnelInsuranceModificationInfo = data;
            if (this.personnelInsuranceModificationInfo.length > 0){
              this.personnelInsuranceModificationInfo.forEach(item=>{
                this.globalStore.mergeAddress({
                  address: item.AAB004,
                  source: '人员参保变更信息',
                  time: item.AAB035
                });
              });
            }
            this.isPersonnelInsuranceModificationLoaded = true;
          }else {
            this.personnelInsuranceModificationInfo = [];
            this.isPersonnelInsuranceModificationLoaded = true;
            this.isPersonnelInsuranceModificationError = true;
          }
        }).catch(e=>{
          console.log("人员参保变更信息加载失败：",e);
          this.personnelInsuranceModificationInfo = [];
          this.isPersonnelInsuranceModificationLoaded = true;
          this.isPersonnelInsuranceModificationError = true;
        })
      }else {
        console.log("人员参保变更信息暂时不对您开放")
      }

      // 35.工伤认定结果信息查询(人社局)
      if (this.globalStore.isWorkInjuryRecognitionOpen){
        await axios.post(
            '/api/external/workInjuryRecognition',
            {idNumber: this.idNumber,
              name: this.name}
        ).then(res => {
          console.log("返回工伤认定结果信息查询(人社局)：",res);
          if (res.data.code === 200){
            const rawData  = res?.data?.data;
            const data = Array.isArray(rawData)
                ? rawData
                : (rawData && Object.keys(rawData).length > 0 ? [rawData] : []);
            console.log("工伤认定结果信息查询(人社局)：",data);
            this.workInjuryRecognitionInfo = data;
            if (this.workInjuryRecognitionInfo.length > 0){
              this.workInjuryRecognitionInfo.forEach(item=>{
                this.globalStore.mergeAddress({
                  address: item.AAB004,
                  source: '工伤认定结果信息查询(人社局)',
                  time: item.ALC020
                });
              });
            }
            this.isWorkInjuryRecognitionLoaded = true;
          }else {
            this.workInjuryRecognitionInfo = [];
            this.isWorkInjuryRecognitionLoaded = true;
            this.isWorkInjuryRecognitionError = true;
          }
        }).catch(e=>{
          console.log("工伤认定结果信息查询(人社局)加载失败：",e);
          this.workInjuryRecognitionInfo = [];
          this.isWorkInjuryRecognitionLoaded = true;
          this.isWorkInjuryRecognitionError = true;
        })
      }else {
        console.log("工伤认定结果信息(人社局)暂时不对您开放")
      }

      // 36.工伤待遇支付明细查询(人社局)
      if (this.globalStore.isInjuryPaymentDetailOpen){
        await axios.post(
            '/api/external/injuryPaymentDetailQuery',
            {idNumber: this.idNumber,
              name: this.name}
        ).then(res => {
          console.log("返回工伤待遇支付明细查询(人社局)：",res);
          if (res.data.code === 200){
            const rawData  = res?.data?.data;
            const data = Array.isArray(rawData)
                ? rawData
                : (rawData && Object.keys(rawData).length > 0 ? [rawData] : []);
            console.log("工伤待遇支付明细查询(人社局)：",data);
            this.injuryPaymentDetailInfo = data;
            if (this.injuryPaymentDetailInfo.length > 0){
              this.injuryPaymentDetailInfo.forEach(item=>{
                this.globalStore.mergeAddress({
                  address: item.AAB004,
                  source: '工伤待遇支付明细查询(人社局)',
                  time: item.ALC020
                });
              });
            }
            this.isInjuryPaymentDetailLoaded = true;
          }else {
            this.injuryPaymentDetailInfo = [];
            this.isInjuryPaymentDetailLoaded = true;
            this.isInjuryPaymentDetailError = true;
          }
        }).catch(e=>{
          console.log("工伤待遇支付明细查询(人社局)加载失败：",e);
          this.injuryPaymentDetailInfo = [];
          this.isInjuryPaymentDetailLoaded = true;
          this.isInjuryPaymentDetailError = true;
        })
      }else {
        console.log("工伤待遇支付明细(人社局)暂时不对您开放")
      }

      // 37.养老生存认证查询(人社局)
      if (this.globalStore.isPensionSurvivalAuthenticationOpen){
        await axios.post(
            '/api/external/pensionSurvivalAuthentication',
            {idNumber: this.idNumber,
              name: this.name}
        ).then(res => {
          console.log("返回养老生存认证查询(人社局)：",res);
          if (res.data.code === 200){
            const rawData  = res?.data?.data;
            const data = Array.isArray(rawData)
                ? rawData
                : (rawData && Object.keys(rawData).length > 0 ? [rawData] : []);
            console.log("养老生存认证查询(人社局)：",data);
            this.pensionSurvivalAuthenticationInfo = data;
            this.isPensionSurvivalAuthenticationLoaded = true;
          }else {
            this.pensionSurvivalAuthenticationInfo = [];
            this.isPensionSurvivalAuthenticationLoaded = true;
            this.isPensionSurvivalAuthenticationError = true;
          }
        }).catch(e=>{
          console.log("养老生存认证查询(人社局)加载失败：",e);
          this.pensionSurvivalAuthenticationInfo = [];
          this.isPensionSurvivalAuthenticationLoaded = true;
          this.isPensionSurvivalAuthenticationError = true;
        })
      }else {
        console.log("养老生存认证(人社局)暂时不对您开放")
      }

      // 38. 加载家庭适龄学生资助减免数据
      await axios.post(
          "/api/poorTeenager/info",
          {
            name: this.name,
            idNumber: this.idNumber
          }
      )
          .then(res => {
            console.log("家庭适龄学生资助减免返回数据:", res);
            const data = res?.data?.data || [];
            console.log("家庭适龄学生资助减免信息", data);
            this.studentassistInfo = data;
            if (this.studentassistInfo.length > 0){
              this.studentassistInfo.forEach(item=>{
                this.globalStore.mergeAddress({
                  address: item.jtzz,
                  source: '家庭适龄学生资助减免信息',
                  time: null,
                });
              });
            }
            this.isstudentassistLoaded = true;
          })
          .catch(e => {
            console.error("家庭适龄学生资助减免信息加载失败:", e);
            this.isstudentassistError = true;
            this.isstudentassistLoaded = true;
            this.studentassistInfo = [];
          });

      // 38. 加载家庭适龄学生资助减免数据
      await axios.post(
          "/api/external/fire",
          {
            name: this.name,
            idNumber: this.idNumber
          }
      )
          .then(res => {
            console.log("身份和火化返回数据:", res);
            const data = res?.data?.data || [];
            console.log("身份和火化信息", data);
            this.liveandfireInfo = data;
            this.isliveandfireLoaded = true;
          })
          .catch(e => {
            console.error("身份和火化信息加载失败:", e);
            this.isliveandfireError = true;
            this.isliveandfireLoaded = true;
            this.liveandfireInfo = [];
          });
      // 39.医疗长期居外或异地安置人员基本信息
      await axios.post(
          '/api/medicalPersonInfo/findByName',
          {name: this.name}
      ).then(res => {
        console.log("医疗长期居外或异地安置人员基本信息",res);
        if (res.data.code === 200){
          const rawData  = res?.data?.data;
          const data = Array.isArray(rawData)
              ? rawData
              : (rawData && Object.keys(rawData).length > 0 ? [rawData] : []);
          console.log("医疗长期居外或异地安置人员基本信息",data);
          this.medicalPersonInfo = data;
          if (this.medicalPersonInfo.length > 0){
            this.medicalPersonInfo.forEach(item=>{
              this.globalStore.mergeAddress({
                address: item.empName,
                source: '医疗长期居外或异地安置人员基本信息',
                time: null,
              });
            });
          }
          this.isMedicalPersonLoaded = true;
        }else {
          this.medicalPersonInfo = [];
          this.isMedicalPersonLoaded = true;
          this.isMedicalPersonError = true;
        }
      }).catch(e=>{
        console.log("医疗长期居外或异地安置人员基本信息加载失败：",e);
        this.medicalPersonInfo = [];
        this.isMedicalPersonLoaded = true;
        this.isMedicalPersonError = true;
      })
      // 设置预测地址
      if (this.meituanData && this.meituanData.mostFrequentAddress) {
        this.predictedAddress = this.meituanData.mostFrequentAddress;
      }

      this.isDataLoaded = true;
      this.adjustLayout(); // 数据加载完成后调整布局
    },

    // 房产信息去重函数
    deduplicateRealEstate(list) {
      if (!list || list.length === 0) return [];
      const seen = new Set();
      return list.filter((item) => {
        if (!item || !item.address) return false;
        if (seen.has(item.address)) return false;
        seen.add(item.address);
        return true;
      });
    },

    // 显示详细信息弹窗
    showDetail(itemId, category) {
      let item;
      switch (category) {
        case "identity":
          item = this.identityLeft.find((i) => i.id === itemId);
          break;
        case "property":
          item = this.propertyRight.find((i) => i.id === itemId);
          break;
        case "consumption":
          item = this.consumptionLeft.find((i) => i.id === itemId);
          break;
        case "action":
          item = this.actionRight.find((i) => i.id === itemId);
          break;
        case "relation":
          item = this.relationLeft.find((i) => i.id === itemId);
          break;
      }

      if (item?.content === "暂无") {
        console.warn("暂无详细信息");
        return;
      }

      switch (category) {
        case "identity":
          this.showIdentityDetail(itemId);
          break;
        case "property":
          this.showPropertyDetail(itemId);
          break;
        case "consumption":
          this.showConsumptionDetail(itemId);
          break;
        case "action":
          this.showActionDetail(itemId);
          break;
        case "relation":
          this.showRelationDetail(itemId);
          break;
      }
    },

    // 显示身份信息详情
    showIdentityDetail(itemId) {
      switch (itemId) {
        case "unit":
          this.dialogTitle = "单位信息";

          if (this.isSocialSecurityError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.socialSecurityInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "currentCompany", label: "当前公司"},
            {prop: "status", label: "参保状态"},
            {prop: "companyName", label: "公司名称"},
            {
              prop: "payTime",
              label: "缴费时间",
              formatter: (row) => {
                const year = row.payYear;
                const month = String(row.payMonth).padStart(2, "0");
                return `${year}-${month}`;
              },
            },
            {prop: "pensionBase", label: "养老基数"},
            {prop: "unemploymentBase", label: "失业基数"},
            {prop: "injuryBase", label: "工伤基数"},
          ];
          break;
        case "marriage":
          this.dialogTitle = "婚姻信息";
          this.dialogTableColumns = [
            {prop: "registrationOrg", label: "登记机关"},
            {prop: "fName", label: "女方姓名"},
            {prop: "fIdNumber", label: "女方身份证号"},
            {prop: "mName", label: "男方姓名"},
            {prop: "mIdNumber", label: "男方身份证号"},
            {prop: "businessType_diclabel", label: "登记类型"},
            {prop: "registrationDate", label: "登记日期"},
          ];

          if (this.isMarriageInfoError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.marriageInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }
          break;
        case "family":
          this.dialogTitle = "家庭信息";

          if (this.isQueryIdError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.familyInfo.filter(
                (person) => person.relation && !person.relation.includes("配偶")
            );
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "name", label: "姓名"},
            {prop: "relation", label: "关系"},
            {prop: "idNumber", label: "身份证号"},
            {prop: "phone", label: "联系电话"},
            {prop: "address", label: "地址"},
          ];
          break;
          // 在 showIdentityDetail 方法中添加以下 case
        case "household":
          this.dialogTitle = "户籍信息";
          // 提取所有家庭成员信息
          const householdDetails = [];

          if (this.isPersonInfoError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            if (this.personalInfo && Object.keys(this.personalInfo).length > 0) {
              for (let i = 1; i <= 7; i++) {
                const name = this.personalInfo[`householdMember${i}Name`];
                if (name) {
                  householdDetails.push({
                    name: name,
                    relationship:
                        this.personalInfo[`householdMember${i}Relationship`] || "未知",
                    idNumber: this.personalInfo[`householdMember${i}Id`] || "未知",
                    gender: this.personalInfo[`householdMember${i}Gender`] || "未知",
                    birthDate: this.personalInfo[`householdMember${i}BirthDate`] || "未知",
                    phone: this.personalInfo[`householdMember${i}Phone`] || "未知",
                  });
                }
              }
            }
            this.dialogTableData = householdDetails;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "name", label: "姓名"},
            {prop: "relationship", label: "关系"},
            {prop: "idNumber", label: "身份证号"},
            {prop: "gender", label: "性别"},
            {prop: "birthDate", label: "出生日期"},
            {prop: "phone", label: "联系电话"},
          ];
          break;
        case 'driveLicence':
          this.dialogTitle = '驾驶证信息(网约车资质信息)';

          if (this.isDriveLicenceError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.driveLicenceInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'HOLDER_NAME', label: '持证人姓名'},
            {prop: 'HOLDER_CODE', label: '持证人身份证号码'},
            {prop: 'CONTACT_PHONE', label: '联系电话'},
            {prop: 'ISSUED_DATE', label: '证照颁发日期'},
            {prop: 'EFFECTIVE_DATE', label: '证照有效期开始日期'},
            {prop: 'EXPIRE_DATE', label: '证照有效期截止日期'}
          ];
          break;
          // 高校学籍信息
        case 'school':
          this.dialogTitle = '高校学籍信息';

          if (this.isSchoolError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.schoolInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'xm', label: '姓名'},
            {prop: 'zjhm', label: '身份证号码'},
            {prop: 'yxmc', label: '就读院校'},
            {prop: 'xz', label: '学制'},
            {prop: 'zjzt', label: '入学日期'},
            {prop: 'rxrq', label: '学籍状态'}
          ];
          break;
        case 'subsistenceAllowance':
          this.dialogTitle = '低保对象信息';

          if(this.isSubsistenceAllowanceError){
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          }else {
            console.log('dialogTableData 是否为数组:', Array.isArray(this.subsistenceAllowanceInfo));
            this.dialogTableData = this.subsistenceAllowanceInfo;
            console.log('dialogTableData 是否为数组:', Array.isArray(this.dialogTableData));
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'gmsfzhm', label: '身份证件号码'},
            {prop: 'xb', label: '性别'},
            {prop: 'csrq', label: '出生日期'},
            {prop: 'dz', label: '地址'},
            {prop: 'xm', label: '姓名'},
            {prop: 'xsdblb', label: '享受低保类别'},
            {prop: 'xsdbqsy', label: '享受低保起始年月'},
            {prop: 'ybzje', label: '月保障金额'},
            {prop: 'ssxzqh', label: '所属行政区划'},
          ];
          break;
        case 'socialSecurityCard':
          this.dialogTitle = '社保卡信息';
          if(this.isSocialSecurityCardError){
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          }else {
            this.dialogTableData = this.socialSecurityCardInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }
          this.dialogTableColumns = [
            {prop: 'bac001', label: '个人编号'},
            {prop: 'baz805', label: '省人员识别码'},
            {prop: 'statusinfo.aaz502', label: '卡应用状态'},
            {prop: 'statusinfo.aaz506', label: '卡变更类型'},
            {prop: 'statusinfo.aae035', label: '变更时间'},
            {prop: 'aae008', label: '银行编号'},
            {prop: 'aae010', label: '银行账号'},
            {prop: 'baz907', label: '所属行政区划'},
            {prop: 'baz848', label: '制卡方式'},
            {prop: 'statusinfo.aaz508', label: '规范版本'},
            {prop: 'baz892', label: '初始化日期'},
            {prop: 'aaz503', label: '发卡日期'},
            {prop: 'aab099', label: '卡有效期'},
            {prop: 'baz802', label: '服务网点机构编号'},
          ]
          break;
        case "liveandfire":
          this.dialogTitle = "身份与火化相关情况";

          if (this.isliveandfireError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.liveandfireInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          console.log(this.liveandfireInfo);
          this.dialogTableColumns = [
            {prop: "swbs", label: "死亡标识"},
            {prop: "name", label: "姓名"},
            {prop: "sex", label: "性别"},
            {prop: "id_card", label: "身份证号码"},
            {prop: "address", label: "地址"},
            {prop: "cremation_time", label: "火化时间"},
          ];
          break;
        case 'hibpersonalInsurance':
          this.dialogTitle = '人员参保（医疗局）信息';

          if (this.ishibpersonalInsuranceError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.hibpersonalInsuranceInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'psn_name', label: '姓名'},
            {prop: 'psn_insu_stas', label: '人员参保状态'},
            {prop: 'crt_insu_date', label: '本次参保日期'},
            {prop: 'acct_crtn_ym', label: '账户建立年月'},
            {prop: 'insutype', label: '险种类型'},
          ];
          break;
        case 'insuredPerson':
          this.dialogTitle = '参保信息（医疗局）信息';

          if (this.isinsuredPersonError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.insuredPersonInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'psn_name', label: '姓名'},
            {prop: 'certno', label: '证件号码'},
            {prop: 'hsreg_addr', label: '户籍地址'},
            {prop: 'tel', label: '联系电话'},
            {prop: 'live_addr', label: '居住地址'},
          ];
          break;
        case 'hrsspersonalInsurance':
          this.dialogTitle = '人员参保（人社局）信息';

          if (this.ishrsspersonalInsuranceError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.hrsspersonalInsuranceInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'AAB004', label: '单位名称'},
            {prop: 'AAE140', label: '险种类型'},
            {prop: 'AAC030', label: '个人参保日期'},
            {prop: 'AAC049', label: '首次参保日期'},
            {prop: 'AAC031', label: '参保状态'},
            {prop: 'AAC040', label: '缴费工资'},
            {prop: 'AAE180', label: '缴费基数'},
            {prop: 'AAC066', label: '参保身份'},
          ];
          break;
        case 'unitInformation':
          this.dialogTitle = '单位基本信息（人社局）信息';

          if (this.isunitInformationError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.unitInformationInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'AAB998', label: '统一社会信用代码'},
            {prop: 'AAB003', label: '组织机构代码'},
            {prop: 'AAB004', label: '单位名称'},
            {prop: 'AAB019', label: '单位类型'},
            {prop: 'AAB078', label: '法定代表人证件号码'},
            {prop: 'BAB068', label: '注册地址'},
            {prop: 'AAE271', label: '经营地址'},
            {prop: 'AAA148', label: '行业名称'},
            {prop: 'AAB008', label: '批准日期'},
            {prop: 'AAA149', label: '行业风险类别'},
            {prop: 'AAE119', label: '单位登记状态'},
          ];
          break;
        case 'personalInformation':
          this.dialogTitle = '人员基本信息（人社局）信息';

          if (this.ispersonalInformationError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.personalInformationInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'AAC002', label: '社会保障号码'},
            {prop: 'AAC003', label: '姓名'},
            {prop: 'AAC147', label: '证件号码'},
            {prop: 'AAC058', label: '证件类型'},
            {prop: 'AAC007', label: '参加工作日期'},
            {prop: 'AAE441', label: '建账时间'},
            {prop: 'AAE473', label: '养老账户类别'},
            {prop: 'BIC162', label: '养老资格认定时间'},
            {prop: 'AAC084', label: '离退休状态'},
            {prop: 'AIC162', label: '离退休日期'},
            {prop: 'AAC067', label: '移动电话'},
            {prop: 'BAC062', label: '人员登记状态'},
            {prop: 'AAC009', label: '户籍性质'},
            {prop: 'AAE006', label: '常住地地址'},
            {prop: 'AAC010', label: '户籍地址'},
          ];
          break;
        case 'retire':
          this.dialogTitle = '企业退休人员信息（人社局）信息';

          if (this.isRetireError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.retireInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'BAC001', label: '个人编号'},
            {prop: 'AAC003', label: '姓名'},
            {prop: 'AAC002', label: '社会保障号'},
            {prop: 'AAC004', label: '性别'},
            {prop: 'AIC162', label: '退休时间'},
            {prop: 'AIC004', label: '出生年月'},
            {prop: 'AAC007', label: '参加工作时间'},
            {prop: 'AIC161', label: '离退休类别'},
            {prop: 'AAE116', label: '待遇发放状态'},
            {prop: 'AAC143', label: '正常'},
            {prop: 'AAE019', label: '养老金'},
            {prop: 'AAE200', label: '缴费年限'}
          ];
          break;
        case 'unitInsurance':
          this.dialogTitle = '单位参保信息';

          if (this.isUnitInsuranceError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.unitInsuranceInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'BAB001', label: '单位编号'},
            {prop: 'AAB004', label: '单位名称'},
            {prop: 'AAE140', label: '险种类型'},
            {prop: 'AAA027', label: '统筹区划'},
            {prop: 'AAB019', label: '单位类型'},
            {prop: 'AAB051', label: '参保状态'},
            {prop: 'AAB050', label: '参保日期'},
            {prop: 'AAA042', label: '单位缴费费率'},
            {prop: 'AAA041', label: '个人缴费费率'}
          ];
          break;
        case 'personnelInsuranceModification':
          this.dialogTitle = '人员参保变更信息查询(人社局)';

          if (this.isPersonnelInsuranceModificationError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.personnelInsuranceModificationInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'BAB001', label: '单位编号'},
            {prop: 'AAB004', label: '单位名称'},
            {prop: 'AAE140', label: '险种类型'},
            {prop: 'AAC050', label: '变更类型'},
            {prop: 'AAE160', label: '变更原因'},
            {prop: 'AAE035', label: '变更日期'},
            {prop: 'AAE011', label: '经办人'},
            {prop: 'AAE036', label: '经办时间'}
          ];
          break;
        case 'workInjuryRecognition':
          this.dialogTitle = '工伤认定结果信息查询(人社局)';

          if (this.isWorkInjuryRecognitionError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.workInjuryRecognitionInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'BAC001', label: '个人编号'},
            {prop: 'AAC002', label: '社会保障号码'},
            {prop: 'BAB001', label: '单位编号'},
            {prop: 'AAB004', label: '单位名称'},
            {prop: 'ALC020', label: '工伤发生日期'},
            {prop: 'ALC027', label: '工伤类型'},
            {prop: 'ALC007', label: '事故类型'},
            {prop: 'ALC042', label: '伤害部位'},
            {prop: 'ALA017', label: '职业病名称'},
            {prop: 'AAE127', label: '申请时间'},
            {prop: 'ALC031', label: '认定时间'},
            {prop: 'ALC011', label: '认定书编号'},
            {prop: 'ALA015', label: '认定结论'},
            {prop: 'BLC635', label: '工伤保险条例规定'},
          ];
          break;
        case 'injuryPaymentDetail':
          this.dialogTitle = '工伤待遇支付明细查询(人社局)';

          if (this.isInjuryPaymentDetailError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.injuryPaymentDetailInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'BAC001', label: '个人编号'},
            {prop: 'AAC002', label: '社会保障号码'},
            {prop: 'AAC003', label: '姓名'},
            {prop: 'BAB001', label: '单位编号'},
            {prop: 'AAB004', label: '单位名称'},
            {prop: 'ALC004', label: '人员类别'},
            {prop: 'AAE002', label: '结算期'},
            {prop: 'AAC107', label: '核定类型'},
            {prop: 'AAE019', label: '支付总金额'},
            {prop: 'AAC130', label: '工伤医疗费'},
            {prop: 'AAC195', label: '伤残津贴'},
            {prop: 'AAC201', label: '养老金工伤补差'},
            {prop: 'AAC196', label: '生活护理费'},
            {prop: 'AAC142', label: '辅助器具安装配置费'},
            {prop: 'AAC199', label: '康复性治疗费'},
            {prop: 'AAC194', label: '一次性伤残补助金'},
            {prop: 'AAC157', label: '一次性工亡补助金'},
            {prop: 'AAC166', label: '丧葬补助金'},
            {prop: 'AAC132', label: '住院伙食补助费'},
            {prop: 'AAC159', label: '一次性工伤医疗补助金'},
            {prop: 'AAC148', label: '统筹地区外就医交通费'},
            {prop: 'AAC153', label: '统筹地区外就医食宿费'},
            {prop: 'AAC197', label: '工伤供养亲属抚恤金'},
            {prop: 'AAC198', label: '劳动能力鉴定费'},
            {prop: 'AAE145', label: '发放方式'},
            {prop: 'ALC020', label: '工伤发生时间'},
          ];
          break;
        case 'pensionSurvivalAuthentication':
          this.dialogTitle = '养老生存认证查询(人社局)';

          if (this.isPensionSurvivalAuthenticationError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.pensionSurvivalAuthenticationInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: 'treatStatus', label: '待遇发放状态'},
            {prop: 'successFlag', label: '养老生存认证状态'},
            {prop: 'socialPoolCode', label: '统筹区编码'},
            {prop: 'pensionAffirmDate', label: '认证终止日期'},

          ];
          break;
        case 'medicalPerson':
          this.dialogTitle = '医疗长期居外或异地安置人员基本信息';
          if (this.isMedicalPersonError){
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          }else{
            this.dialogTableData = this.medicalPersonInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }
          this.dialogTableColumns = [
            {prop: 'psnName', label: '人员姓名'},
            {prop: 'psnNo', label: '人员编号'},
            {prop: 'psnCertType', label: '人员证件类型'},
            {prop: 'psnInsuRltsId', label: '人员参保关系ID'},
            {prop: 'certno', label: '证件号码'},
            {prop: 'tel', label: '联系电话'},
            {prop: 'empName', label: '单位名称'},
            {prop: 'trtDclaDetlSn', label: '待遇申报明细流水号'},
          ];
          break;
      }
      this.dialogVisible = true;
    },

    // 显示财产信息详情
    showPropertyDetail(itemId) {
      switch (itemId) {
        case "vehicle":
          this.dialogTitle = "车辆信息";

          if (this.isVehicleError) {
            this.dialogTableData = [];
            if (this.isVehicleError) {
              // 外部接口错误
              this.dialogEmptyText = "请检查网络环境或联系接口管理员";
            } else {
              // 非外部接口错误
              this.dialogEmptyText = "数据库异常请联系相关工作人员";
            }
          } else {
            this.dialogTableData = this.vehicleInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "VEHICLENUM", label: "车牌号"},
            {prop: "ANNULEXPIRYDATE", label: "年审有效日期"},
            {prop: "BRAND", label: "厂牌"},
            {prop: "CERTSTATE", label: "证件状态"},
            {prop: "DRIVINGREGDATE", label: "行驶证初领日期"},
            {prop: "INSPECTDATE", label: "年审日期"},
            {prop: "ISSUEORGNAME", label: "发证机构"},
            {prop: "LICENSEENDDATE", label: "证件有效期止"},
            {prop: "LICENSEFIRSTDATE", label: "证件初领日期"},
            {prop: "VEHICLEID", label: "车辆Id"},
          ];
          break;
        case "estate":
          this.dialogTitle = "房产信息";

          if (this.isQueryIdError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.realEstateInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "address", label: "地址"},
            {prop: "ownerName", label: "所有权人"},
            {prop: "buildingArea", label: "建筑面积(㎡)"},
            {prop: "landArea", label: "土地面积(㎡)"},
            {prop: "mortgageAmount", label: "抵押金额(万元)"},
            {prop: "isSeized", label: "是否查封"},
            {prop: "coOwnershipStatus", label: "共有情况"},
            {prop: "landPurpose", label: "土地用途"},
          ];
          break;
        case "bank":
          this.dialogTitle = "银行卡信息";

          if (this.isBankAccountError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.bankCardInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "openingBank", label: "银行名称"},
            {prop: "accountNo", label: "账号"},
            {prop: "balance", label: "余额(元)"},
            {prop: "accountType", label: "账户类型"},
            {prop: "postalAddress", label: "通讯地址"},
            {prop: "phone", label: "联系电话"},
          ];
          break;
        case "secondHandHouse":
          this.dialogTitle = "二手房交易信息";

          if (this.isSecondHandHouseError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.secondHandHouseData;
            this.dialogEmptyText = "经查询暂无数据";
          }

          console.log(this.secondHandHouseData);
          this.dialogTableColumns = [
            {prop: "FWZL", label: "房屋地址"},
            {prop: "CQZH", label: "产权证号"},
            {prop: "HTBH", label: "合同编号"},
            {prop: "JZMJ", label: "建筑面积(㎡)"},
            {
              prop: "JG",
              label: "交易金额(元)",
              formatter: (row) => row.JG ? parseFloat(row.JG).toLocaleString() : "0"
            },
            {prop: "WQRXM", label: "买受人"},
            {prop: "JYBASJ", label: "交易日期"},
            {prop: "ZTMS", label: "交易状态"},
            {prop: "HTDYZTMS", label: "合同打印状态"}
          ];
          break;
        case "houseOwnership":
          this.dialogTitle = "房屋权属信息";
          // this.dialogTableData = this.houseOwnershipData;
          // console.log(this.houseOwnershipData);

          if (this.isHouseOwnershipError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            // 检查是否有合并后的数据，如果没有但原始数据存在，则显示原始数据
            if (this.mergePDF && this.mergePDF.length > 0) {
              this.dialogTableData = this.mergePDF;
            } else if (this.houseOwnershipData && this.houseOwnershipData.length > 0) {
              this.dialogTableData = this.houseOwnershipData;
            } else {
              this.dialogTableData = [];
            }
            this.dialogEmptyText = "经查询暂无数据";
          }
          console.log(this.mergePDF);
          this.dialogTableColumns = [
            {prop: "bdcdyh", label: "不动产单元号"},
            {prop: "bdclx", label: "不动产类型"},
            {prop: "fwzl", label: "地址"},
            {prop: "fwyt", label: "房屋用途"},
            {prop: "zdmj", label: "占地面积(㎡)"},
            {prop: "tdsyqx", label: "土地使用期限"},
            {prop: "djyy", label: "登记原因"},
            {prop: "djsj", label: "登记时间"},
            {prop: "qlxz", label: "权利现状"},
            { prop: "fwxxlist[0].jyjg", label: "交易价格" },
            { prop: "jzmj", label: "建筑面积" },
            { prop: "gyfs", label: "共有方式" },
            { prop: "qlr", label: "权利人" },
            { prop: "qlrxxlist[0].gyfe", label: "共有份额" },
            { prop: "qlrxxlist[0].gyqk", label: "共有情况" },
            { prop: "qlrzjh", label: "权利人证件号" },
            { prop: "qlxz", label: "权利性质" },
            { prop: "dyaqxxlist[0].dyaqlr", label: "抵押权人" },
            { prop: "dyaqxxlist[0].bdbzqse", label: "被担保债权数额" },
            { prop: "dyaqxxlist[0].zgzqe", label: "最高债权数额" },
            { prop: "cfxxlist[0].cfwh", label: "查封文号" },
            { prop: "cfxxlist[0].cfjg", label: "查封机构" },
            { prop: "cfxxlist[0].cfqx", label: "查封期限" },
            {
              prop: "qszt",
              label: "权属状态",
            },
            {
              prop: "file", label: "PDF",
            }
          ];
          break;
        case "cityHouse":
          this.dialogTitle = "全市有无房持有情况";

          if (this.isCityHouseError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.cityHouseData;
            this.dialogEmptyText = "经查询暂无数据";
          }

          console.log(this.cityHouseData);
          this.dialogTableColumns = [
            {prop: "bdcdyh", label: "不动产单元号"},
            {prop: "bdclx", label: "不动产类型"},
            {prop: "jzmj", label: "建筑面积(㎡)"},
            {prop: "bdcqzh", label: "不动产产权证号"},
            {prop: "djsj", label: "登记日期"},
            {prop: "djyy", label: "登记原因"},
            {prop: "xzzt", label: "房产状态"},
            {prop: "cfzt", label: "查封状态"},
            {prop: "dyzt", label: "抵押状态"},
            {prop: "jzqzt", label: "居住权状态"},
            {prop: "fwyt", label: "房屋用途"},
            {prop: "fwzl", label: "房屋坐落"},
            {prop: "jyjg", label: "交易价格（元）"},
            {prop: "qlr", label: "权利人"},
            {prop: "qlrxxlist[0].qlrzjh", label: "权利人证件号"},
            {prop: "qlxz", label: "权利性质"},
            {prop: "qszt", label: "权属状态"},
          ];
          break;
        case "crossCar":
          this.dialogTitle = "两客一危持有情况";

          if (this.isCrossCarError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.crossCarInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          console.log(this.crossCarInfo);
          this.dialogTableColumns = [
            {prop: "VEHICLEID", label: "车辆ID"},
            {prop: "VEHICLENUM", label: "车牌号"},
            //{ prop: "", label: "车辆类型" },
            {prop: "OWNERNAME", label: "业户名称"},
            {prop: "OWNERTEL", label: "联系电话"},
          ];
          break;
        case "ship":
          this.dialogTitle = "船舶相关情况";

          if (this.isShipError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.shipInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          console.log(this.shipInfo);
          this.dialogTableColumns = [
            {prop: "BEFORENAME", label: "曾用名"},
            {prop: "BUILDDATE", label: "建造日期"},
            {prop: "CAPTAINNAME", label: "船长姓名"},
            {prop: "CERTSTATE", label: "证件状态代码"},
            {prop: "ENTLICENSENO", label: "船舶经营人许可证号"},
            {prop: "ENTRUSTMENTCONTRACTDATE", label: "船舶适任证书期限"},
            {prop: "RUNNER", label: "经营人"},
          ];
          break;
        case "studentassist":
          this.dialogTitle = "家庭适龄学生资助减免相关情况";

          if (this.isstudentassistError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          } else {
            this.dialogTableData = this.studentassistInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          console.log(this.studentassistInfo);
          this.dialogTableColumns = [
            {prop: "xx", label: "学校"},
            {prop: "xm", label: "学生姓名"},
            {prop: "xb", label: "性别"},
            {prop: "sfzhm", label: "身份证号码"},
            {prop: "xjh", label: "学籍号"},
            {prop: "rxnf", label: "入学年份"},
            {prop: "bj", label: "班级"},
            {prop: "knlx", label: "困难类型"},
            {prop: "jhr", label: "监护人"},
            {prop: "jhrsfzhm", label: "监护人身份证号码"},
            {prop: "jtzz", label: "家庭住址"},
            {prop: "lxdh", label: "联系电话"},
            {prop: "xsbrsbkkh", label: "学生本人社保卡卡号"},
            {prop: "khh", label: "开户行"},
            {prop: "zzje", label: "资助金额"},
          ];
          break;
        case "residentDistribution":
          this.dialogTitle = '居民待遇信息';
          if (this.isResidentDistributionError){
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          }else{
            this.dialogTableData = this.residentDistributionInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }
          console.log(this.residentDistributionInfo);
          this.dialogTableColumns = [
            {prop: "BAB302", label: "统筹区"},
            {prop: "AAE019", label: "发放金额"},
            {prop: "AAE140", label: "险种类别"},
            {prop: "AAE145", label: "发放方式"},
            {prop: "AAF200", label: "银行类别"},
            {prop: "AAE208", label: "实付年月"},
          ];
          break;
        case "personalPayment":
          this.dialogTitle = '人员缴费信息';
          if (this.isPaymentInfoError){
            this.dialogTableData = [];
            this.dialogEmptyText = "请检查网络环境或联系接口管理员";
          }else {
            this.dialogTableData = this.personalPaymentInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }
          console.log(this.personalPaymentInfo);
          this.dialogTableColumns = [
            {prop: "AAA115", label: "缴费类型"},
            {prop: "AAA027", label: "统筹区话"},
            {prop: "AAC003", label: "姓名"},
            {prop: "AAB004", label: "单位名称"},
            {prop: "AAA020", label: "利息"},
            {prop: "AAE202", label: "缴费月数"},
            {prop: "AAC002", label: "社会保障号码"},
            {prop: "AAE003", label: "对应费款所属期"},
            {prop: "AAE002", label: "费款所属期"},
            {prop: "AAA021", label: "滞纳金"},
            {prop: "AAE132", label: "缴费标志"},
            {prop: "AAE482", label: "缴费基数"},
            {prop: "AAE140", label: "险种类型"},
            {prop: "AAE481", label: "个人缴费金额"},
            {prop: "AAE480", label: "单位缴费金额"},
            {prop: "AAA080", label: "合计缴费金额"},
            {prop: "AAB191", label: "到账日期"},
            {prop: "BAB001", label: "单位编号"},
            {prop: "BAC001", label: "个人编号"},
          ];
          break;
        case "other":
          this.dialogTitle = "其他财产信息";

          let allOtherProperty = [];
          let hasData = false;

          // 企业信息
          if (this.isPersonEnterpriseError) {
            // 错误状态不添加数据
          } else if (this.personEnterpriseInfo && this.personEnterpriseInfo.length > 0) {
            allOtherProperty = [...allOtherProperty, ...this.personEnterpriseInfo.map((item) => ({type: "企业信息", ...item}))];
            hasData = true;
          }

          // 公积金信息
          if (this.isHousingFundError) {
            // 错误状态不添加数据
          } else if (this.housingFundInfo && this.housingFundInfo.length > 0) {
            allOtherProperty = [...allOtherProperty, ...this.housingFundInfo.map((item) => ({type: "公积金", ...item}))];
            hasData = true;
          }

          // 金融资产信息
          if (this.isFinancialError) {
            // 错误状态不添加数据
          } else if (this.financialInfo && this.financialInfo.length > 0) {
            allOtherProperty = [...allOtherProperty, ...this.financialInfo.map((item) => ({type: "金融资产", ...item}))];
            hasData = true;
          }

          if (this.isPersonEnterpriseError || this.isHousingFundError || this.isFinancialError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = allOtherProperty;
            this.dialogEmptyText = hasData ? "经查询暂无数据" : "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "type", label: "类型"},
            {prop: "enterpriseName", label: "企业/资产名称"},
            {prop: "enterpriseStatus", label: "企业状态"},
            {prop: "balance", label: "余额"},
            {prop: "companyName", label: "公司名称"},
            {prop: "assetName", label: "资产名称"},
            {prop: "assetType", label: "资产类型"},
            {prop: "feedbacker", label: "反馈人"},
          ];
          break;
      }
      this.dialogVisible = true;
    },

    // 显示消费信息详情
    showConsumptionDetail(itemId) {
      switch (itemId) {
        case "takeout":
          this.dialogTitle = "外卖信息";
          this.dialogTableData = [];
          this.dialogTableColumns = [];
          break;
        case "online":
          this.dialogTitle = "网购信息";

          if (this.isMeituanError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.meituanOrderList;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "lastActiveTime", label: "最新活跃时间"},
            {prop: "creationTime", label: "快递创建时间"},
            {prop: "recName", label: "收件人姓名"},
            {prop: "recAddress", label: "收件人地址"},
            {prop: "recPhone", label: "收件人电话"},
            {prop: "goodsName", label: "商品信息"},
          ];
          break;
        case "express":
          this.dialogTitle = "快递信息";

          if (this.isMeituanOrderError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.expressInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "senderName", label: "发件人"},
            {prop: "receiverName", label: "收件人"},
            {prop: "address", label: "地址"},
            {prop: "deliveryTime", label: "投递时间"},
            {prop: "phone", label: "联系电话"},
          ];
          break;
      }
      this.dialogVisible = true;
    },

    // 显示行动轨迹详情
    showActionDetail(itemId) {
      switch (itemId) {
        case "residence":
          this.dialogTitle = "居住地信息";

          if (this.isMeituanError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.meituanData ? [this.meituanData] : [];
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "mostFrequentAddress", label: "推测居住地址"},
          ];
          break;
        case "frequent":
          this.dialogTitle = "高频地址信息";

          if (this.isSelfAddressFrequencyError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.selfAddressFrequency;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "recAddress", label: "地址"},
            {prop: "frequency", label: "频次"},
          ];
          break;
        case "recent":
          this.dialogTitle = "近期活动区域";
          // 显示高频地址信息中的第一个地址
          if (this.isSelfAddressFrequencyError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            if (this.selfAddressFrequency && this.selfAddressFrequency.length > 0) {
              // 确保数据格式是数组
              this.dialogTableData = [this.selfAddressFrequency[0]];
            } else {
              // 当高频地址信息为空时显示暂无数据
              this.dialogTableData = [{recAddress: "暂无数据"}];
            }
            this.dialogEmptyText = "经查询暂无数据";
          }
          this.dialogTableColumns = [{prop: "recAddress", label: "地址"}];
          break;
      }
      this.dialogVisible = true;
    },

    // 显示关联信息详情
    showRelationDetail(itemId) {
      switch (itemId) {
        case "related":
          this.dialogTitle = "关联人信息";

          if (this.isRelatedPeopleError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.relatedPeople;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "recName", label: "姓名"},
            {prop: "recPhone", label: "电话"},
            {prop: "recAddress", label: "地址"},
          ];
          break;
        case "relatedProperty":
          this.dialogTitle = "涉企信息信息";

          if (this.isPersonEnterpriseError) {
            this.dialogTableData = [];
            this.dialogEmptyText = "数据库异常请联系相关工作人员";
          } else {
            this.dialogTableData = this.personEnterpriseInfo;
            this.dialogEmptyText = "经查询暂无数据";
          }

          this.dialogTableColumns = [
            {prop: "enterpriseName", label: "企业名称"},
            {prop: "enterpriseStatus", label: "企业状态"},
            {prop: "registeredCapital", label: "注册资本"},
            {prop: "isException", label: "是否异常"},
            {prop: "legalRepresentative", label: "法定代表人"},
            {prop: "businessScope", label: "经营范围"},
            {prop: "registrationAuthority", label: "登记机关"},
          ];
          break;
      }
      this.dialogVisible = true;
    },
  },
  mounted() {
    // 获取父组件传入的参数
    if (this.idNumber) {
      this.loadData();
    }

    // 监听窗口大小变化，调整布局
    window.addEventListener("resize", this.adjustLayout);

    // 初始加载时调整布局
    this.$nextTick(() => {
      this.adjustLayout();
    });
  },
  beforeUnmount() {
    window.removeEventListener("resize", this.adjustLayout);
  },
};
</script>


<style scoped>
/* 鱼骨图容器，适应父组件的卡片 */
.fishbone-wrapper {
  width: 100%;
  min-height: 700px;
  /* 提高默认最小高度 */
  overflow: visible;
  box-sizing: border-box;
  position: relative;
  transition: min-height 0.3s ease;
  /* 平滑过渡高度变化 */
}

/* 内容包装器，用于填充剩余空间并居中内容 */
.content-wrapper {
  width: 100%;
  height: auto;
  min-height: 700px;
  /* 确保内容包装器也有足够高度 */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* 从顶部开始布局 */
  padding: 20px;
  box-sizing: border-box;
  overflow: visible;
}

/* 鱼骨图容器，允许水平滚动但隐藏滚动条 */
.fishbone-container {
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding: 20px 0;
  box-sizing: border-box;
  /* 隐藏滚动条但保留功能 */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.fishbone-container::-webkit-scrollbar {
  display: none;
}

/* 鱼骨图主体，使用相对定位确保垂直居中 */
.fishbone {
  position: relative;
  min-height: 700px;
  /* 增加鱼骨图主体最小高度 */
  height: auto;
  display: flex;
  align-items: center;
  min-width: 1000px;
  box-sizing: border-box;
  transition: transform 0.3s ease;
  /* 平滑缩放过渡 */
  padding: 200px 0 200px;
  /* 增加上下留白，防止子节点被遮挡 */
}

/* 鱼头样式 */
.fish-head {
  width: 120px;
  height: 160px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 2;
  transition: all 0.3s ease;
  margin-right: -25px;
}

.fish-head:hover {
  transform: scale(1.05);
}

/* 鱼头图片样式 */
.head-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50% 30% 30% 50%;
}

/* 主骨样式 - 作为中轴线，使用蓝色渐变 */
.main-bone {
  flex-grow: 1;
  position: relative;
  height: 8px;
  margin: 0;
  background: linear-gradient(90deg, #3498db, #2980b9, #1abc9c, #3498db, #2980b9);
  background-size: 400% 100%;
}

/* 主节点样式 - 确保围绕中轴线居中 */
.main-node {
  position: absolute;
  width: 120px;
  margin-left: -60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
  top: 50%;
  transform: translateY(-50%);
}

.node-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  text-align: center;
  z-index: 2;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  cursor: pointer;
  padding: 10px;
  font-size: 22px;
  line-height: 1.3;
  background-size: 100% 100%;
}

.node-circle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.node-circle i {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0.8;
}

/* 节点位置 - 平均分布在主骨上 */
.identity-node {
  left: 10%;
}

.property-node {
  left: 30%;
}

.consumption-node {
  left: 50%;
}

.action-node {
  left: 70%;
}

.relation-node {
  left: 90%;
}

/* 节点颜色 - 使用从左到右的蓝色渐变 */
.identity-node .node-circle {
  background: linear-gradient(135deg, #3498db, #2980b9);
}

.property-node .node-circle {
  background: linear-gradient(135deg, #2980b9, #1abc9c);
}

.consumption-node .node-circle {
  background: linear-gradient(135deg, #1abc9c, #3498db);
}

.action-node .node-circle {
  background: linear-gradient(135deg, #3498db, #2980b9);
}

.relation-node .node-circle {
  background: linear-gradient(135deg, #2980b9, #1abc9c);
}

/* 激活状态样式 */
.main-node.active .node-circle {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
  /* 蓝色阴影 */
}

/* 分支样式 */
.branches {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 20px;
  opacity: 0;
  width: 180px;
  transition: all 0.3s ease;
}

/* 向下展开的分支 - 增加与主节点的距离 */
.expand-down .branches {
  top: 130px;
  animation: fadeInDown 0.4s ease forwards;
}

/* 向上展开的分支 - 增加与主节点的距离 */
.expand-up .branches {
  bottom: 130px;
  animation: fadeInUp 0.4s ease forwards;
}

/* 居中对齐分支 */
.centered {
  left: 50%;
  transform: translateX(-50%);
}

/* 分支动画延迟 */
.identity-node .branches {
  animation-delay: 0.1s;
}

.property-node .branches {
  animation-delay: 0.1s;
}

.consumption-node .branches {
  animation-delay: 0.1s;
}

.action-node .branches {
  animation-delay: 0.1s;
}

.relation-node .branches {
  animation-delay: 0.1s;
}

.branch-box {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  background-color: white;
  transform: scale(0.95);
  opacity: 0;
  animation: branchFadeIn 0.3s ease forwards;
}

/* 每个分支项依次出现 */
.branch-box:nth-child(1) {
  animation-delay: 0.1s;
}

.branch-box:nth-child(2) {
  animation-delay: 0.2s;
}

.branch-box:nth-child(3) {
  animation-delay: 0.3s;
}

.branch-box:nth-child(4) {
  animation-delay: 0.4s;
}

.branch-box:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-3px) scale(1.02);
}

.box-title {
  padding: 8px 12px;
  background-color: #f5f5f5;
  border-bottom: 1px solid #eee;
  font-weight: 600;
  color: #333;
  border-radius: 6px 6px 0 0;
}

.box-content {
  padding: 10px 12px;
  font-size: 14px;
  color: #666;
}

/* 鱼尾样式 */
.fish-tail {
  width: 120px;
  height: 160px;
  position: relative;
  display: flex;
  align-items: center;
  margin-left: -20px;
}

/* 鱼尾图片样式 */
.tail-image {
  width: 80px;
  height: 120px;
  object-fit: contain;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* 动画效果 */
@keyframes fadeInDown {
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes branchFadeIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 响应式调整 */
@media (max-width: 1200px) {
  .branch-box {
    width: 180px;
  }

  .branches {
    width: 180px;
  }

  .node-circle {
    width: 100px;
    height: 100px;
    font-size: 20px;
  }

  .main-node {
    width: 100px;
    margin-left: -50px;
  }

  .fish-head {
    width: 100px;
    height: 130px;
    margin-right: -8px;
  }

  .fish-tail {
    width: 100px;
    height: 130px;
    margin-left: -8px;
  }

  .tail-image {
    width: 70px;
    height: 100px;
  }
}

@media (max-width: 992px) {
  .branch-box {
    width: 150px;
    font-size: 13px;
  }

  .branches {
    width: 150px;
  }

  .box-content {
    font-size: 12px;
  }

  .identity-node {
    left: 5%;
  }

  .relation-node {
    left: 95%;
  }

  .fishbone {
    padding: 180px 0;
    /* 响应式下也保持足够留白 */
  }

  .fish-head {
    width: 90px;
    height: 110px;
    margin-right: -6px;
  }

  .node-circle {
    font-size: 18px;
  }
}

@media (max-width: 768px) {
  .fishbone {
    padding: 160px 0;
    min-width: 800px;
  }

  .branches {
    gap: 15px;
  }

  .fish-head {
    width: 80px;
    height: 100px;
    margin-right: -5px;
  }

  .fish-tail {
    width: 80px;
    height: 100px;
    margin-left: -5px;
  }

  .tail-image {
    width: 60px;
    height: 80px;
  }

  .node-circle {
    font-size: 17px;
  }
}

@media (max-width: 576px) {
  .fishbone {
    padding: 150px 0;
    min-width: 600px;
  }

  .node-circle {
    width: 90px;
    height: 90px;
    font-size: 16px;
  }

  .branch-box {
    width: 130px;
  }

  .expand-down .branches,
  .expand-up .branches {
    top: 130px;
    bottom: auto;
  }

  .fish-head {
    width: 70px;
    height: 90px;
    margin-right: -4px;
  }

  .fish-tail {
    width: 70px;
    height: 90px;
    margin-left: -4px;
  }
}

/* 禁用状态的分支盒子样式 */
.branch-box.disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  user-select: none;
  pointer-events: none;
}

.branch-box.disabled .box-title {
  background-color: #eeeeee;
  color: #999;
}

.branch-box:not(.disabled) {
  cursor: pointer;
}

/* 弹窗表格样式 */
.el-dialog__body {
  padding: 20px;
}
</style>
